I have a string like below
{
"id": "abc",
"title": "123.png",
"description": "fruits",
"information": [
{
"type": "apple",
"url": "https://apple.com"
},
{
"type": "orange",
"url": "https://orange.com"
}
],
"versions": 0
}
I want to get the value of url
where type: orange
. The list in information
may not always be in same order as appearing in the data above. I know I could do it easily in python with json.loads
and json.dump
.
I am trying to do it java using JsonNode
and objectMapper.readTree.at("/information")
but I am unable to get past this point in a clever neat way to get the list and fetch the url where type = orange.