How to get JSON Object from JSONNode Array?

I have a JsonNode which looks like:

    "ObjectIWantToRetrieve": {
      "key0": {
        "key1": {
          "key2": "val3"

I wish to get the ObjectIWantToRetrieve out
The equivalent of JsonNode.get("ObjectIWantToRetrieve"). Can anyone help me?
Should I be converting the JSONNode to ArrayNode Please advice thank you

>Solution :

You should convert it to JSONObject first like this :

ObjectNode value = ((ObjectNode) JsonNode.get(0)).get("ObjectIWantToRetrieve")

Leave a Reply