I have following JSON
{"subscription":
{
"callbackReference": "xyz" ,
"criteria": "Vote",
"destinationAddress": "3456" ,
"notificationFormat" : "JSON"
}
}
I want to check whether "notificationFormat" elements exits there using JSONPath expression. I can get the value of above element using following JSONPath expression.
$.subscription.notificationFormat
Can I use similar kind of expression which returns boolean value checking whether elements exists ?
If I understood your question correct here is an answer.
This would check if notificationFormat exists in your json.
$.subscription[?(@.notificationFormat)]
That would get all destinationAddress in case if notificationFormat exists
$.subscription[?(@.notificationFormat)].destinationAddress