josdejong / svelte-jsoneditor

A web-based tool to view, edit, format, repair, query, transform, and validate JSON
https://jsoneditoronline.org
Other
904 stars 109 forks source link

JMES Query not working in JSONeditor #483

Closed amhaats1 closed 3 weeks ago

amhaats1 commented 3 weeks ago

Sample JSON

{
  "locations": [
    {"name": "Seattle", "state": "WA"},
    {"name": "New York", "state": "NY"},
    {"name": "Bellevue", "state": "WA"},
    {"name": "Olympia", "state": "WA"}
  ]
}

Trying to perfom query

locations[?state == 'WA'].name | sort(@) | {WashingtonCities: join(', ', @)}

Getting syntax error

SyntaxError: Unexpected token '?'

I can put the same JSON in https://jmespath.org/

and get the proper return

Result

{
  "WashingtonCities": "Bellevue, Olympia, Seattle"
}
josdejong commented 3 weeks ago

How can I reproduce your issue?

josdejong commented 3 weeks ago

I think that you have not selected/loaded the JMESPath query language and are using Lodash instead. You can select a query language via the gear icon top right of the Transform modal.

amhaats1 commented 3 weeks ago

Thank you very much and for the very fast response, that did the trick!!!