dchester / jsonpath

Query and manipulate JavaScript objects with JSONPath expressions. Robust JSONPath engine for Node.js.
MIT License
1.33k stars 215 forks source link

Error when extracting two fields from parent #146

Open steosoft opened 4 years ago

steosoft commented 4 years ago

I have json like this:

{
"app_version":"APP-VERSION-1.3.1d",
"version":"VERSION-2.3.5",
"device_id":"3129824",
"receive_time":1598973254602
[...]
}

and I would like to extract two fields: "version" and "app_version". I tried with expressions like: '$.[version,app_version]', '$[version,app_version]', '$.version,app_version', '$version,app_version' but neither worked. I always have error like: Expecting 'STAR', 'IDENTIFIER', 'SCRIPT_EXPRESSION', 'INTEGER', 'END', got '['

I've checked these expressions in evaluator on https://jsonpath.com/ and they worked there.

I've looked at Differences from Original Implementation but it doesn't seem to have impact here.