Add JsonNode.asArray() and JsonNode.asObject() (original) (raw)
In the same way that there is various methods to manipulate a JsonNode to one of its potential real type (String, boolean, etc), there should be asArray() and asObject() available.
Currently the only way to retrieve a JsonNode as an ObjectNode or an ArrayNode is with the two methods with(String) and withArray(String) (even though in 2.9 their return type is broken).
But for example when manipulating an ArrayNode, it is not possible to get its elements as ArrayNode or ObjectNode (or I didn't find the way to do it).
I would expect to be able, for example, to do:
for(JsonNode node: anArrayNode) { node.asObject().set("a", new TextNode("b")); }