Sometimes, what you really want to do is query all items that meet a certain criteria, such as those exceed a particular threshold. JSONPath provides the
?() predicate, which lets you execute simple comparison scripts of individual fields in your JSONPath.
Here's an example that queries all books costing less than
10 currency units:
$.store.book[?(@.price < 10)].title
The query begins by specifying all book items in the store; the
?() predicate then selects each item in that category using the
@ selector to obtain the value of the current item, and then selects prices less than
10. The resulting items have their title field extracted. This query yields the following ...