When passing the following string to jsonPath to filter a collection of objects:
$[?(en|**|(@.object.property.one=='other') && (@.object.property.two=='something(abc/def)'))]
I receive the following error:
jsonPath: Unexpected token ILLEGAL: (_v.object.property.one=='other') && (_v.object.property.two=='something(abc/def))
My initial guess is that the illegal character has something to do with round brackets or a forward slash present within a literal value. This might explain why a closing single quote around the last literal is missing. I have tried escaping both the round brackets and forward slash but to no avail. What would cause the filter method to throw the above exception?
Having a quick read over the jsonPath documentation it looks like brackets don’t do the job you’d think.
In XPath, brackets are used to do groupings however in jsonPath they’re used for script expressions (using whatever the underlying script engine is).
It could be that the value you’re presenting as the script expression is invalid.