JSONPath 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/):
-
$[-1]
Input:["first", "second", "third"]
Expected output:
["third"]
Actual output:
[]
-
$[:]
Input:["first", "second"]
Expected output:
["first", "second"]
Actual output:
[]
-
$[1:]
Input:["first", "second", "third", "forth", "fifth"]
Expected output:
["second", "third", "forth", "fifth"]
Actual output:
[]
-
$[0:3:2]
Input:["first", "second", "third", "forth", "fifth"]
Expected output:
["first", "third"]
Error:
timeout: sending signal TERM to command ‘build/main’
-
$[0:3:1]
Input:["first", "second", "third", "forth", "fifth"]
Expected output:
["first", "second", "third"]
Error:
timeout: sending signal TERM to command ‘build/main’
-
$[0:4:2]
Input:["first", "second", "third", "forth", "fifth"]
Expected output:
["first", "third"]
Error:
timeout: sending signal TERM to command ‘build/main’
-
$[::2]
Input:["first", "second", "third", "forth", "fifth"]
Expected output:
["first", "third", "fifth"]
Actual output:
[]
-
$[?(@.key==42)]
Input:[{"key": 0}, {"key": 42}, {"key": -1}, {"key": 41}, {"key": 43}, {"key": 42.0001}, {"key": 41.9999}, {"key": 100}, {"some": "value"}]
Expected output:
[{"key": 42}]
Error:
Unable to compile selector `$[?(@.key==42)]': Invalid array index definition “?(@.key==42)]”
-
$[?(@.key=="some.value")]
Input:[{"key": "some"}, {"key": "value"}, {"key": "some.value"}]
Expected output:
[{"key": "some.value"}]
Error:
Unable to compile selector `$[?(@.key=="some.value")]': Invalid array index definition “?(@.key=="some.value")]”
-
$[?(@.key=='value')]
Input:[{"key": "some"}, {"key": "value"}]
Expected output:
[{"key": "value"}]
Error:
Unable to compile selector `$[?(@.key=='value')]': Invalid array index definition “?(@.key=='value')]”
-
$[?(@.key>42)]
Input:[{"key": 0}, {"key": 42}, {"key": -1}, {"key": 41}, {"key": 43}, {"key": 42.0001}, {"key": 41.9999}, {"key": 100}]
Expected output:
[{"key": 43}, {"key": 42.0001}, {"key": 100}]
Error:
Unable to compile selector `$[?(@.key>42)]': Invalid array index definition “?(@.key>42)]”
-
$[?(@.key<42)]
Input:[{"key": 0}, {"key": 42}, {"key": -1}, {"key": 41}, {"key": 43}, {"key": 42.0001}, {"key": 41.9999}, {"key": 100}, {"some": "value"}]
Expected output:
[{"key": 0}, {"key": -1}, {"key": 41}, {"key": 41.9999}]
Error:
Unable to compile selector `$[?(@.key<42)]': Invalid array index definition “?(@.key<42)]”
-
$[?(@.key)]
Input:[{"some": "some value"}, {"key": "value"}]
Expected output:
[{"key": "value"}]
Error:
Unable to compile selector `$[?(@.key)]': Invalid array index definition “?(@.key)]”
-
$['one','three'].key
Input:{"one": {"key": "value"}, "two": {"k": "v"}, "three": {"some": "more", "key": "other value"}}
Expected output:
["value", "other value"]
Actual output:
["value"]
-
$['*']
Input:{"*": "value", "another": "entry"}
Expected output:
["value"]
Actual output:
["value", "entry"]
-
$..key
Input:{"object": {"key": "value", "array": [{"key": "something"}, {"key": {"key": "russian dolls"}}]}, "key": "top"}
Expected output:
["russian dolls", "something", "top", "value", {"key": "russian dolls"}]
Actual output:
["something", "top", "value", {"key": "russian dolls"}]
-
$..*
Input:{"key": "value", "another key": {"complex": "string", "primitives": [0, 1]}}
Expected output:
["string", "value", 0, 1, [0, 1], {"complex": "string", "primitives": [0, 1]}]
Actual output:
[]
-
$..*
Input:[40, null, 42]
Expected output:
[40, null, 42]
Actual output:
[]
-
$[*]
Input:{"some": "string", "int": 42, "object": {"key": "value"}, "array": [0, 1]}
Expected output:
["string", 42, [0, 1], {"key": "value"}]
Actual output:
[{"array": [0, 1], "int": 42, "object": {"key": "value"}, "some": "string"}]
-
$.*
Input:["string", 42, {"key": "value"}, [0, 1]]
Expected output:
["string", 42, {"key": "value"}, [0, 1]]
Actual output:
[["string", 42, {"key": "value"}, [0, 1]]]
For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/C_json-glib.