I'm trying to return the value of 'id', where value is "India" in nested JSON as shown below
{
"iterations": [
{
"id": "122",
"parameters": [
{
"name": "Country",
"value": "US"
}
]
},
{
"id": "123",
"parameters": [
{
"name": "Country",
"value": "India"
}
]
}
]
}
I have already referenced similar question question asked JsonPath Conditionals Nested Two Arrays Deep
I tried
$.iterations[?(@.parameters[?(@.value=='India')])].id
$.iterations[?(@..[?(@.value == 'India')])].id
Every time the expression is returning all 2 parameter items. Any help would be much appreciated.