I have a JSON file in the format below.
{
"queryResponse":[
{
"id":"1",
"name":"Parent1",
"childList":[
{
"id":"11",
"type":"A"
},
{
"id":"12",
"type":"B"
}
]
},
{
"id":"2",
"name":"Parent2",
"childList":[
{
"id":"21",
"type":"B"
},
{
"id":"22",
"type":"C"
}
]
}
]
}
Using jayway JsonPath, how do I get all the Parent nodes which have child nodes with type "B"?
These filter expressions returned an empty array:
- a wild card in the index like $.queryResponse[?(@.childList[*].type=='B')]
- a deep scan operator in the filter field like $.queryResponse[?(@.childList..type=='B')]
The only filter expression that is closest to what I want is the one with array index for ex: $.queryResponse[?(@.childList[0].type=='A')]