h2non / jsonpath-ng

Finally, a JSONPath implementation for Python that aims to be standard compliant. That's all. Enjoy!
Apache License 2.0
564 stars 85 forks source link

&& not supported in JSONPath #129

Closed athario closed 11 months ago

athario commented 11 months ago

This is a valid JSONPath query:

$.dataset[?(@.property_type_1 == 1 && @.property_type_2 == 1)]

however the following response is received:

jsonpath_ng.exceptions.JsonPathParserError: Parse error at 1:48 near token & (&)

(1:48 is not the correct position due to obfuscation)

It would be great to be able to do this as it enables dual filtering.

michaelmior commented 11 months ago

As far as I am aware, the JSONPath specification does not include support for complex Boolean expressions. However, you should be able to do this using a single ampersand.

michaelmior commented 11 months ago

Closing as this should be resolvable with a slight change in the expression. Please reopen if this doesn't solve your issue.