jp icon indicating copy to clipboard operation
jp copied to clipboard

jp not doing the same as the playground

Open haanjde opened this issue 1 year ago • 1 comments

input: {"z":{"a":{"b":"c"},"g":{"b":"d"},"h":{"b":"e"},"i":{"b":"f"}}} expression: z.*|[?b == `d`] on the playground returns: [ { "b": "d" } ] but on Debian 12.5 jp version 0.2.1 with: jp --filename z.json --expr-file z.jp returns: Error evaluating JMESPath expression: invalid character 'd' looking for beginning of value with return code 1.

haanjde avatar May 22 '24 11:05 haanjde

Can confirm. I suspect this is related to handling of literals. The playground (and python implementation) interpret

`1`

as the number 1 and

`a`

as the string "a". jp does not seem to have the automatic string interpretation.

See

$ echo '[]' | jp '`a`'
Error evaluating JMESPath expression: invalid character 'a' looking for beginning of value

versus

Image

draegerben avatar Mar 28 '25 13:03 draegerben