Given the below Json input:
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}
I need to select the author field if the author matches a given name for eg. Evelyn Waugh
. I am struggling to write the JsonPath Expression for this. I tried the following with no success. Can anyone suggest the correct expression?
$.author?(@ == 'Evelyn Waugh')
$.?(@.author == 'Evelyn Waugh')
$..?(@.author == 'Evelyn Waugh')
Add your root object into an array before executing the query. Then this should work.
With jsonpath