I have jsonPath as below
{ "book":
[
{ "category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{ "category": "fiction",
"author": "Nigel Rees",
"title": "Sword of Honour",
"price": 12.99
}
]}
And want to check if any author name is repeated? I tried
$.book[?(@.author=='Nigel Rees')].find(1)
But it always throws an exception that didn’t find anything, how can I verify that author='Nigel Rees'ie entries author='Nigel Rees'have two books?
source
share