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:3]
Input:{ ":": 42, "more": "string", "a": 1, "b": 2, "c": 3, "1:3": "nice" }
Expected output:
[]
Actual output:
[ "nice" ]
-
$[:]
Input:{ ":": 42, "more": "string" }
Expected output:
[]
Actual output:
[ 42 ]
-
$[0:3:0]
Input:[ "first", "second", "third", "forth", "fifth" ]
Error:
<--- Last few GCs ---> [56662:0xaaaaf8599230] 319 ms: Mark-sweep 24.4 (41.6) -> 8.7 (41.6) MB, 4.1 / 0.0 ms (average mu = 0.804, current mu = 0.876) allocation failure; scavenge might not succeed [56662:0xaaaaf8599230] 352 ms: Mark-sweep 34.4 (51.6) -> 12.0 (44.9) MB, 6.6 / 0.0 ms (average mu = 0.802, current mu = 0.799) allocation failure; scavenge might not succeed <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 0xffff8d7e2f60 node::Abort() [/lib/aarch64-linux-gnu/libnode.so.109] 2: 0xffff8d6ee108 void node::FPrintF<>(_IO_FILE*, char const*) [/lib/aarch64-linux-gnu/libnode.so.109] 3: 0xffff8db671dc v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/lib/aarch64-linux-gnu/libnode.so.109] 4: 0xffff8db673cc v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/lib/aarch64-linux-gnu/libnode.so.109] 5: 0xffff8dd51fb8 [/lib/aarch64-linux-gnu/libnode.so.109] 6: 0xffff8dd66ba8 v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/lib/aarch64-linux-gnu/libnode.so.109] 7: 0xffff8dd43cc0 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/aarch64-linux-gnu/libnode.so.109] 8: 0xffff8dd44e38 v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/lib/aarch64-linux-gnu/libnode.so.109] 9: 0xffff8dd25f50 v8::internal::Factory::AllocateRaw(int, v8::internal::AllocationType, v8::internal::AllocationAlignment) [/lib/aarch64-linux-gnu/libnode.so.109] 10: 0xffff8dd1e450 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller(v8::internal::Handle<v8::internal::Map>, int, v8::internal::Handle<v8::internal::Oddball>, v8::internal::AllocationType) [/lib/aarch64-linux-gnu/libnode.so.109] 11: 0xffff8dd31f4c v8::internal::Factory::NewJSArrayStorage(v8::internal::ElementsKind, int, v8::internal::ArrayStorageAllocationMode) [/lib/aarch64-linux-gnu/libnode.so.109] 12: 0xffff8dd31ff8 v8::internal::Factory::NewJSArray(v8::internal::ElementsKind, int, int, v8::internal::ArrayStorageAllocationMode, v8::internal::AllocationType) [/lib/aarch64-linux-gnu/libnode.so.109] 13: 0xffff8e105a8c v8::internal::Runtime_StringSplit(int, unsigned long*, v8::internal::Isolate*) [/lib/aarch64-linux-gnu/libnode.so.109] 14: 0xffff8da8406c [/lib/aarch64-linux-gnu/libnode.so.109]
-
$["key"]
Input:{ "key": "value" }
Expected output:
["value"]
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$[]
Input:{ "": 42, "''": 123, "\"\"": 222 }
Expected output:
NOT_SUPPORTED
Actual output:
[ { "": 42, "\"\"": 222, "''": 123 } ]
-
$['']
Input:{ "": 42, "''": 123, "\"\"": 222 }
Expected output:
[42]
Actual output:
[ { "": 42, "\"\"": 222, "''": 123 } ]
-
$[""]
Input:{ "": 42, "''": 123, "\"\"": 222 }
Expected output:
[42]
Actual output:
[ 222 ]
-
$[-1]
Input:[ "first", "second", "third" ]
Expected output:
["third"]
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$[0]
Input:{ "0": "value" }
Expected output:
[]
Actual output:
[ "value" ]
-
$[0]
Input:"Hello World"
Expected output:
[]
Actual output:
[ "H" ]
-
$['single'quote']
Input:{ "single'quote": "value" }
Expected output:
NOT_SUPPORTED
Actual output:
[ "value" ]
-
$['*']
Input:{ "another": "entry" }
Expected output:
[]
Actual output:
[ "entry" ]
-
$[ 'a' ]
Input:{ " a": 1, "a": 2, " a ": 3, "a ": 4, " 'a' ": 5, " 'a": 6, "a' ": 7, " \"a\" ": 8, "\"a\"": 9 }
Expected output:
[2]
Actual output:
[ 5 ]
-
$['two'.'some']
Input:{ "one": { "key": "value" }, "two": { "some": "more", "key": "other value" }, "two.some": "42", "two'.'some": "43" }
Expected output:
NOT_SUPPORTED
Actual output:
[ "43" ]
-
$[two.some]
Input:{ "one": { "key": "value" }, "two": { "some": "more", "key": "other value" }, "two.some": "42" }
Expected output:
NOT_SUPPORTED
Actual output:
[ "more" ]
-
$[key]
Input:{ "key": "value" }
Expected output:
NOT_SUPPORTED
Actual output:
[ "value" ]
-
$.[key]
Input:{ "key": "value", "other": { "key": [ { "key": 42 } ] } }
Expected output:
NOT_SUPPORTED
Actual output:
[ "value", [ { "key": 42 } ], 42 ]
-
$.
Input:{ "key": 42, "": 9001, "''": "nice" }
Expected output:
NOT_SUPPORTED
Actual output:
[ { "": 9001, "''": "nice", "key": 42 } ]
-
$.length
Input:[ 4, 5, 6 ]
Expected output:
[]
Actual output:
[ 3 ]
-
$a
Input:{ "a": 1, "$a": 2 }
Expected output:
NOT_SUPPORTED
Actual output:
[ 1 ]
-
`` Input:
{ "a": 42, "": 21 }
Error:
undefined
-
$[?(@['@key']==42)]
Input:[ { "@key": 0 }, { "@key": 42 }, { "key": 42 }, { "@key": 43 }, { "some": "value" } ]
Expected output:
[{"@key": 42}]
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$[?(@.key-dash == 'value')]
Input:[ { "key-dash": "value" } ]
Error:
jsonPath: dash is not defined: _v.key-dash == 'value'
-
$[?(@.2 == 'second')]
Input:[ { "a": "first", "2": "second", "b": "third" } ]
Error:
jsonPath: Unexpected number: _v.2 == 'second'
-
$[?(@.2 == 'third')]
Input:[ [ "first", "second", "third", "forth", "fifth" ] ]
Error:
jsonPath: Unexpected number: _v.2 == 'third'
-
$[?()]
Input:[ 1, { "key": 42 }, "value", null ]
Expected output:
NOT_SUPPORTED
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$[?(@[0:1]==[1])]
Input:[ [ 1, 2, 3 ], [ 1 ], [ 2, 3 ], 1, 2 ]
Error:
jsonPath: Unexpected token :: _v[0:1]==[1]
-
$[?(@.*==[1,2])]
Input:[ [ 1, 2 ], [ 2, 3 ], [ 1 ], [ 2 ], [ 1, 2, 3 ], 1, 2, 3 ]
Error:
jsonPath: Unexpected token *=: _v.*==[1,2]
-
$[?(@[0:1]==1)]
Input:[ [ 1, 2, 3 ], [ 1 ], [ 2, 3 ], 1, 2 ]
Error:
jsonPath: Unexpected token :: _v[0:1]==1
-
$[?(@[*]==2)]
Input:[ [ 1, 2 ], [ 2, 3 ], [ 1 ], [ 2 ], [ 1, 2, 3 ], 1, 2, 3 ]
Error:
jsonPath: Unexpected token *: _v[*]==2
-
$[?(@.*==2)]
Input:[ [ 1, 2 ], [ 2, 3 ], [ 1 ], [ 2 ], [ 1, 2, 3 ], 1, 2, 3 ]
Error:
jsonPath: Unexpected token *=: _v.*==2
-
$[?(@.id==2)]
Input:{ "id": 2 }
Expected output:
[]
Actual output:
[ 2 ]
-
$[?(@.key=="value")]
Input:[ { "key": "some" }, { "key": "value" }, { "key": null }, { "key": 0 }, { "key": 1 }, { "key": -1 }, { "key": "" }, { "key": {} }, { "key": [] }, { "key": "valuemore" }, { "key": "morevalue" }, { "key": [ "value" ] }, { "key": { "some": "value" } }, { "key": { "key": "value" } }, { "some": "value" } ]
Expected output:
[{"key": "value"}]
Actual output:
[ { "key": "value" }, { "key": [ "value" ] } ]
-
$[?(@.key=="hi@example.com")]
Input:[ { "key": "some" }, { "key": "value" }, { "key": "hi@example.com" } ]
Expected output:
[{"key": "hi@example.com"}]
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$[?(length(@) == 4)]
Input:[ [ 1, 2, 3, 4, 5 ], [ 1, 2, 3, 4 ], [ 1, 2, 3 ] ]
Error:
jsonPath: length is not defined: length(_v) == 4
-
$[?(@.length() == 4)]
Input:[ [ 1, 2, 3, 4, 5 ], [ 1, 2, 3, 4 ], [ 1, 2, 3 ] ]
Error:
jsonPath: _v.length is not a function: _v.length() == 4
-
$[?(@.length == 4)]
Input:[ [ 1, 2, 3, 4, 5 ], [ 1, 2, 3, 4 ], [ 1, 2, 3 ] ]
Expected output:
[]
Actual output:
[ [ 1, 2, 3, 4 ] ]
-
$[?(@.key='value')]
Input:[ { "key": 0 }, { "key": "value" }, null, { "key": 42 }, { "some": "value" } ]
Expected output:
NOT_SUPPORTED
Actual output:
[ { "key": "value" }, { "key": "value" }, { "key": "value" }, { "key": "value", "some": "value" } ]
-
$[?(@.a.*)]
Input:[ { "a": 0 }, { "a": "x" }, { "a": false }, { "a": true }, { "a": null }, { "a": [] }, { "a": [ 1 ] }, { "a": [ 1, 2 ] }, { "a": {} }, { "a": { "x": "y" } }, { "a": { "x": "y", "w": "z" } } ]
Error:
jsonPath: Unexpected token *: _v.a.*
-
$[*].bookmarks[?(@.page == 45)]^^^
Input:[ { "title": "Sayings of the Century", "bookmarks": [ { "page": 40 } ] }, { "title": "Sword of Honour", "bookmarks": [ { "page": 35 }, { "page": 45 } ] }, { "title": "Moby Dick", "bookmarks": [ { "page": 3035 }, { "page": 45 } ] } ]
Expected output:
NOT_SUPPORTED
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$[?(@[*]>=4)]
Input:[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
Error:
jsonPath: Unexpected token *: _v[*]>=4
-
$.x[?(@[*]>=$.y[*])]
Input:{ "x": [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], "y": [ 3, 4, 5 ] }
Error:
jsonPath: Unexpected token *: _v[*]>=$.y[*]
-
$[?(@.key=42)]
Input:[ { "key": 0 }, { "key": 42 }, { "key": -1 }, { "key": 1 }, { "key": 41 }, { "key": 43 }, { "key": 42.0001 }, { "key": 41.9999 }, { "key": 100 }, { "key": "some" }, { "key": "42" }, { "key": null }, { "key": 420 }, { "key": "" }, { "key": {} }, { "key": [] }, { "key": [ 42 ] }, { "key": { "key": 42 } }, { "key": { "some": 42 } }, { "some": "value" } ]
Expected output:
NOT_SUPPORTED
Actual output:
[ { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42 }, { "key": 42, "some": "value" } ]
-
$[?(@.a[?(@.price>10)])]
Input:[ { "a": [ { "price": 1 }, { "price": 3 } ] }, { "a": [ { "price": 11 } ] }, { "a": [ { "price": 8 }, { "price": 12 }, { "price": 3 } ] }, { "a": [] } ]
Error:
jsonPath: Unexpected token ?: _v.a[?(_v.price>10)
-
$[?(@.a.b.c==3)]
Input:[ { "a": { "b": { "c": 3 } } }, { "a": 3 }, { "c": 3 }, { "a": { "b": { "c": 2 } } } ]
Expected output:
[{"a": {"b": {"c": 3}}}]
Error:
jsonPath: Cannot read properties of undefined (reading 'c'): _v.a.b.c==3
-
$[?(1==1)]
Input:[ 1, 3, "nice", true, null, false, {}, [], -1, 0, "" ]
Expected output:
[1, 3, "nice", true, null, false, {}, [], -1, 0, ""]
Actual output:
[ 1, 3, "nice", true, {}, [], -1 ]
-
$.*[?(@.key)]
Input:[ { "some": "some value" }, { "key": "value" } ]
Expected output:
[]
Actual output:
[ "value" ]
-
$[?(@..child)]
Input:[ { "key": [ { "child": 1 }, { "child": 2 } ] }, { "key": [ { "child": 2 } ] }, { "key": [ {} ] }, { "key": [ { "something": 42 } ] }, {} ]
Error:
jsonPath: Unexpected token .: _v..child
-
$.data.sum()
Input:{ "data": [ 1, 2, 3, 4 ] }
Expected output:
NOT_SUPPORTED
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
-
$(key,more)
Input:{ "key": 1, "some": 2, "more": 3 }
Expected output:
NOT_SUPPORTED
Error:
jsonPath: key is not defined: (key,more)
-
$.key..
Input:{ "some key": "value", "key": { "complex": "string", "primitives": [ 0, 1 ] } }
Expected output (in any order as no consensus on ordering exists):
NOT_SUPPORTED
Actual output:
[ [ 0, 1 ], { "complex": "string", "primitives": [ 0, 1 ] } ]
-
$
Input:false
Expected output:
[false]
Error:
undefined
-
$[(@.length-1)]
Input:[ "first", "second", "third", "forth", "fifth" ]
Expected output:
NOT_SUPPORTED
Actual output:
[ "fifth" ]
-
$[?(@.key<3),?(@.key>6)]
Input:[ { "key": 1 }, { "key": 8 }, { "key": 3 }, { "key": 10 }, { "key": 7 }, { "key": 2 }, { "key": 6 }, { "key": 4 } ]
Error:
jsonPath: Unexpected token ): _v.key<3),?(_v.key>6
-
$[ 0 , 1 ]
Input:[ "first", "second", "third" ]
Expected output:
["first", "second"]
Actual output: NOT_FOUND
jsonpath returned false, this might indicate an error
For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/JavaScript_Goessner.