jsonpath
jsonpath copied to clipboard
Results do not match other implementations
The following queries provide results that do not match those of other implementations of JSONPath (compare https://cburgmer.github.io/json-path-comparison/):
-
[ ]
$.2Input:{"a": "first", "2": "second", "b": "third"}Expected output:
["second"]Error:
parsing error: $.2 :1:2 - 1:4 unexpected Float while scanning operator -
[ ]
$[-1]Input:["first", "second", "third"]Expected output:
["third"]Error:
index -1 out of bounds -
[ ]
$[?(@.key=='value')]Input:[{"key": "some"}, {"key": "value"}]Expected output:
[{"key": "value"}]Error:
parsing error: $[?(@.key=='value')] :1:12 - 1:19 could not parse string: invalid syntax -
[ ]
$[?(@.key)]Input:[{"some": "some value"}, {"key": "value"}]Expected output:
[{"key": "value"}]Actual output:
[] -
[ ]
$['key']Input:{"key": "value"}Expected output:
["value"]Error:
parsing error: $['key'] :1:3 - 1:8 could not parse string: invalid syntax -
[ ]
$['one','three'].keyInput:{"one": {"key": "value"}, "two": {"k": "v"}, "three": {"some": "more", "key": "other value"}}Expected output:
["value", "other value"]Error:
parsing error: $['one','three'].key :1:3 - 1:8 could not parse string: invalid syntax -
[ ]
$['two.some']Input:{"one": {"key": "value"}, "two": {"some": "more", "key": "other value"}, "two.some": "42"}Expected output:
["42"]Error:
parsing error: $['two.some'] :1:3 - 1:13 could not parse string: invalid syntax -
[ ]
$['special:"chars']Input:{"special:\"chars": "value"}Expected output:
["value"]Error:
parsing error: $['special:"chars'] :1:3 - 1:19 could not parse string: invalid syntax
For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Golang_github.com-PaesslerAG-jsonpath.