How do I get a particular array element’s value whose position keeps changing using NiFi JsonPath
Input JSON:
{
"phones": [
{
"type": "H",
"countryCode": "US",
"number": "1113802141",
"operation": "INSERT"
},
{
"type": "M",
"countryCode": "US",
"number": "2225336782",
"operation": "INSERT"
},
{
"type": "B",
"countryCode": "US",
"number": "3337274003",
"operation": "INSERT"
}
}
I’m trying to get the value of “operationType” of the array element that has type=’M’.
$.phones[?(@.type==’M’)].operationType -> THIS DOESN’T WORK in NiFi Evaluate Json path.
Can you suggest how else I can solve this? the position of array element “type”: “M” keeps changing for different operations.