I have an array in JSON and I would like to apply two filters to it like so:
$._embedded.values[0]._embedded.data[?(@.var1='value1' && @.var2='value2')]
I need to select only those elements from the array that satisfies the AND operation. However, in practice this doesn't appear to work.
Is it possible to do this or must I perform a two step action to extract one set then filter again to get my final results?
The Jayway implementation supports inlined AND and OR criteria.
$..book[?(@.price==8.99 && @.category=='fiction')]
[
{
"category" : "fiction",
"author" : "Herman Melville",
"title" : "Moby Dick",
"isbn" : "0-553-21311-3",
"price" : 8.99
}
]
Try it out and compare different implementations here http://jsonpath.herokuapp.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With