I have this json:
{
"text":[
{"a":1},
{"b":2}
]
}
I have this code:
JsonNode jsonNode = (new ObjectMapper()).readTree(jsonString);
//get first element from "text"
//this is just an explanation of what i want
String aValue = jsonNode.get("text")[0]
.get("a")
.asText();
How I can done that, without mapping it to an object?
Or do something like JsonNode[] array
and array[0]
represent a
and array[1]
represent b