PaesslerAG / jsonpath

BSD 3-Clause "New" or "Revised" License
172 stars 37 forks source link

Single quotes don't work for strings within a JSONPath #1

Closed tkuhlman closed 5 years ago

tkuhlman commented 6 years ago

When using this library I noticed that single quotes do not work within a JSONPath, specifically I was evaluating a path like $.data.attributes[?(@.name=='title')].value which fails but changing to double quotes around title like $.data.attributes[?(@.name=="title")].value works fine. I'm not sure if the JSONPath spec addresses quoting at all but the evaluator at http://jsonpath.com/ handles the single quotes fine.

kairichard commented 6 years ago

Thanks for reporting the issue - we have a look at the spec and fix it accordingly. //cc @paessler-jekeller

generikvault commented 6 years ago

jsonpath has no formal specification and the (script) language jsonpath is used in is also part of jsonpath. http://jsonpath.com/ uses js as script language so " and ' works fine. But yes, it would be nice to have them.

generikvault commented 5 years ago

I've wrote a gval language extension for single Quotes. Just include it to the language and singlequotes will be parsed.

github.com/generikvault/gvalstrings