SMJJSONPath icon indicating copy to clipboard operation
SMJJSONPath copied to clipboard

Can't use single quotes with `in` and `nin` predicate operator ?

Open amaheshwari02 opened this issue 1 year ago • 1 comments

"records": [ [ "key": "1", "value": "one" ], [ "key": "2", "value": "two" ], [ "key": "3", "value": "three" ], ]

Path: "$.records[?(@.key in ['1', '2'])]"

The given path is throwing error SMJEvaluatorEvaluateError. It is because getting an error while creating SMJJsonNode here

_json = [NSJSONSerialization JSONObjectWithData:[_jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingAllowFragments error:&lerror];

amaheshwari02 avatar Jan 31 '24 20:01 amaheshwari02

Thanks for your report. It's a limitation of the original implementation I'm using, which handle this part as a JSON fragment. It means that in your case, the path needs to be $.records[?(@.key in ["1", "2"])] (valid JSON).

I don't have plans to fix that anytime soon.

Regarding the silent error, it's a known issue (// XXX why "accept" drop predicate error there ?). I need to fix that at some point.

javerous avatar Feb 01 '24 12:02 javerous