-
-
Notifications
You must be signed in to change notification settings - Fork 27
Queries
Below, you will find a list of queries, which are currently supported by this library. This list has been created, based on the great comparison list project by Christoph Burgmer.
Other queries might be supported too, but there's no consensus (aka expected result), therefore it is unclear if the results returned are correct, or not.
Corresponding unit/functional tests for these specific queries can be found here.
Array Slice
- Array Slice
- Array Slice On Exact Match
- Array Slice On Non Overlapping Array
- Array Slice On Object
- Array Slice On Partially Overlapping Array
- Array Slice With Negative Start And End And Range Of -1
- Array Slice With Negative Start And End And Range Of 0
- Array Slice With Negative Start And End And Range Of 1
- Array Slice With Negative Start And Positive End And Range Of -1
- Array Slice With Negative Start And Positive End And Range Of 0
- Array Slice With Negative Start And Positive End And Range Of 1
- Array Slice With Open End
- Array Slice With Open Start
- Array Slice With Open Start And End
- Array Slice With Open Start And End And Step Empty
- Array Slice With Positive Start And Negative End And Range Of -1
- Array Slice With Positive Start And Negative End And Range Of 0
- Array Slice With Positive Start And Negative End And Range Of 1
- Array Slice With Range Of -1
- Array Slice With Range Of 0
- Array Slice With Range Of 1
- Array Slice With Start -1 And Open End
- Array Slice With Start -2 And Open End
- Array Slice With Start Large Negative Number And Open End On Short Array
- Array Slice With Step
- Array Slice With Step 1
- Array Slice With Step And Leading Zeros
- Array Slice With Step But End Not Aligned
- Array Slice With Step Empty
- Array Slice With Step Only
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[1:3]
Consensus:
[
"second",
"third"
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[0:5]
Consensus:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[7:10]
Consensus:
[]
Test Data:
{
":": 42,
"more": "string",
"a": 1,
"b": 2,
"c": 3,
"1:3": "nice"
}
Selector:
$[1:3]
Consensus:
[]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[1:10]
Consensus:
[
"second",
"third"
]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[-4:-5]
Consensus:
[]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[-4:-4]
Consensus:
[]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[-4:-3]
Consensus:
[
4
]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[-4:1]
Consensus:
[]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[-4:2]
Consensus:
[]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[-4:3]
Consensus:
[
4
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[1:]
Consensus:
[
"second",
"third",
"forth",
"fifth"
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[:2]
Consensus:
[
"first",
"second"
]
Test Data:
[
"first",
"second"
]
Selector:
$[:]
Consensus:
[
"first",
"second"
]
Test Data:
[
"first",
"second"
]
Selector:
$[::]
Consensus:
[
"first",
"second"
]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[3:-4]
Consensus:
[]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[3:-3]
Consensus:
[]
Test Data:
[
2,
"a",
4,
5,
100,
"nice"
]
Selector:
$[3:-2]
Consensus:
[
5
]
Test Data:
[
"first",
"second",
"third",
"forth"
]
Selector:
$[2:1]
Consensus:
[]
Test Data:
[
"first",
"second"
]
Selector:
$[0:0]
Consensus:
[]
Test Data:
[
"first",
"second"
]
Selector:
$[0:1]
Consensus:
[
"first"
]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[-1:]
Consensus:
[
"third"
]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[-2:]
Consensus:
[
"second",
"third"
]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[-4:]
Consensus:
[
"first",
"second",
"third"
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[0:3:2]
Consensus:
[
"first",
"third"
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[0:3:1]
Consensus:
[
"first",
"second",
"third"
]
Test Data:
[
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25
]
Selector:
$[010:024:010]
Consensus:
[
10,
20
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[0:4:2]
Consensus:
[
"first",
"third"
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[1:3:]
Consensus:
[
"second",
"third"
]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[::2]
Consensus:
[
"first",
"third",
"fifth"
]
Bracket Notation
- Bracket Notation
- Bracket Notation After Recursive Descent
- Bracket Notation On Object Without Key
- Bracket Notation With NFC Path On NFD Key
- Bracket Notation With Dot
- Bracket Notation With Double Quotes
- Bracket Notation With Empty String
- Bracket Notation With Empty String Doubled Quoted
- Bracket Notation With Negative Number On Short Array
- Bracket Notation With Number
- Bracket Notation With Number -1
- Bracket Notation With Number -1 On Empty Array
- Bracket Notation With Number 0
- Bracket Notation With Number After Dot Notation With Wildcard On Nested Arrays With Different Length
- Bracket Notation With Number On Short Array
- Bracket Notation With Quoted Array Slice Literal
- Bracket Notation With Quoted Closing Bracket Literal
- Bracket Notation With Quoted Current Object Literal
- Bracket Notation With Quoted Dot Literal
- Bracket Notation With Quoted Dot Wildcard
- Bracket Notation With Quoted Double Quote Literal
- Bracket Notation With Quoted Number On Object
- Bracket Notation With Quoted Root Literal
- Bracket Notation With Quoted Union Literal
- Bracket Notation With Quoted Wildcard Literal
- Bracket Notation With String Including Dot Wildcard
- Bracket Notation With Wildcard After Array Slice
- Bracket Notation With Wildcard After Dot Notation After Bracket Notation With Wildcard
- Bracket Notation With Wildcard After Recursive Descent
- Bracket Notation With Wildcard On Array
- Bracket Notation With Wildcard On Empty Array
- Bracket Notation With Wildcard On Empty Object
- Bracket Notation With Wildcard On Null Value Array
- Bracket Notation With Wildcard On Object
Test Data:
{
"key": "value"
}
Selector:
$['key']
Consensus:
[
"value"
]
Test Data:
[
"first",
{
"key": [
"first nested",
{
"more": [
{
"nested": [
"deepest",
"second"
]
},
[
"more",
"values"
]
]
}
]
}
]
Selector:
$..[0]
Consensus:
[
"deepest",
"first nested",
"first",
"more",
{
"nested": [
"deepest",
"second"
]
}
]
Test Data:
{
"key": "value"
}
Selector:
$['missing']
Consensus:
[]
Test Data:
{
"u\u0308": 42
}
Selector:
$['ü']
Consensus:
[]
Test Data:
{
"one": {
"key": "value"
},
"two": {
"some": "more",
"key": "other value"
},
"two.some": "42"
}
Selector:
$['two.some']
Consensus:
[
"42"
]
Test Data:
{
"key": "value"
}
Selector:
$["key"]
Consensus:
[
"value"
]
Test Data:
{
"": 42,
"''": 123,
"\"\"": 222
}
Selector:
$['']
Consensus:
[
42
]
Test Data:
{
"": 42,
"''": 123,
"\"\"": 222
}
Selector:
$[""]
Consensus:
[
42
]
Test Data:
[
"one element"
]
Selector:
$[-2]
Consensus:
[]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[2]
Consensus:
[
"third"
]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[-1]
Consensus:
[
"third"
]
Test Data:
[]
Selector:
$[-1]
Consensus:
[]
Test Data:
[
"first",
"second",
"third",
"forth",
"fifth"
]
Selector:
$[0]
Consensus:
[
"first"
]
Bracket Notation With Number After Dot Notation With Wildcard On Nested Arrays With Different Length
Test Data:
[
[
1
],
[
2,
3
]
]
Selector:
$.*[1]
Consensus:
[
3
]
Test Data:
[
"one element"
]
Selector:
$[1]
Consensus:
[]
Test Data:
{
":": "value",
"another": "entry"
}
Selector:
$[':']
Consensus:
[
"value"
]
Test Data:
{
"]": 42
}
Selector:
$[']']
Consensus:
[
42
]
Test Data:
{
"@": "value",
"another": "entry"
}
Selector:
$['@']
Consensus:
[
"value"
]
Test Data:
{
".": "value",
"another": "entry"
}
Selector:
$['.']
Consensus:
[
"value"
]
Test Data:
{
"key": 42,
".*": 1,
"": 10
}
Selector:
$['.*']
Consensus:
[
1
]
Test Data:
{
"\"": "value",
"another": "entry"
}
Selector:
$['"']
Consensus:
[
"value"
]
Test Data:
{
"0": "value"
}
Selector:
$['0']
Consensus:
[
"value"
]
Test Data:
{
"$": "value",
"another": "entry"
}
Selector:
$['$']
Consensus:
[
"value"
]
Test Data:
{
",": "value",
"another": "entry"
}
Selector:
$[',']
Consensus:
[
"value"
]
Test Data:
{
"*": "value",
"another": "entry"
}
Selector:
$['*']
Consensus:
[
"value"
]
Test Data:
{
"nice": 42,
"ni.*": 1,
"mice": 100
}
Selector:
$['ni.*']
Consensus:
[
1
]
Test Data:
[
[
1,
2
],
[
"a",
"b"
],
[
0,
0
]
]
Selector:
$[0:2][*]
Consensus:
[
1,
2,
"a",
"b"
]
Test Data:
[
{
"bar": [
42
]
}
]
Selector:
$[*].bar[*]
Consensus:
[
42
]
Test Data:
{
"key": "value",
"another key": {
"complex": "string",
"primitives": [
0,
1
]
}
}
Selector:
$..[*]
Consensus:
[
"string",
"value",
0,
1,
[
0,
1
],
{
"complex": "string",
"primitives": [
0,
1
]
}
]
Test Data:
[
"string",
42,
{
"key": "value"
},
[
0,
1
]
]
Selector:
$[*]
Consensus:
[
"string",
42,
{
"key": "value"
},
[
0,
1
]
]
Test Data:
[]
Selector:
$[*]
Consensus:
[]
Test Data:
{}
Selector:
$[*]
Consensus:
[]
Test Data:
[
40,
null,
42
]
Selector:
$[*]
Consensus:
[
40,
null,
42
]
Test Data:
{
"some": "string",
"int": 42,
"object": {
"key": "value"
},
"array": [
0,
1
]
}
Selector:
$[*]
Consensus:
[
"string",
42,
[
0,
1
],
{
"key": "value"
}
]
Dot Notation
- Dot Notation
- Dot Notation After Array Slice
- Dot Notation After Bracket Notation After Recursive Descent
- Dot Notation After Bracket Notation With Wildcard
- Dot Notation After Bracket Notation With Wildcard On One Matching
- Dot Notation After Bracket Notation With Wildcard On Some Matching
- Dot Notation After Filter Expression
- Dot Notation After Recursive Descent
- Dot Notation After Recursive Descent After Dot Notation
- Dot Notation After Union
- Dot Notation After Union With Keys
- Dot Notation On Array
- Dot Notation On Array Value
- Dot Notation On Array With Containing Object Matching Key
- Dot Notation On Empty Object Value
- Dot Notation On Null Value
- Dot Notation On Object Without Key
- Dot Notation With Dash
- Dot Notation With Key Named In
- Dot Notation With Key Named Length
- Dot Notation With Key Named Length On Array
- Dot Notation With Key Named Null
- Dot Notation With Key Named True
- Dot Notation With Non ASCII Key
- Dot Notation With Number On Object
- Dot Notation With Wildcard After Dot Notation After Dot Notation With Wildcard
- Dot Notation With Wildcard After Dot Notation With Wildcard On Nested Arrays
- Dot Notation With Wildcard After Recursive Descent
- Dot Notation With Wildcard After Recursive Descent On Null Value Array
- Dot Notation With Wildcard After Recursive Descent On Scalar
- Dot Notation With Wildcard On Array
- Dot Notation With Wildcard On Empty Array
- Dot Notation With Wildcard On Empty Object
- Dot Notation With Wildcard On Object
Test Data:
{
"key": "value"
}
Selector:
$.key
Consensus:
[
"value"
]
Test Data:
[
{
"key": "ey"
},
{
"key": "bee"
},
{
"key": "see"
}
]
Selector:
$[0:2].key
Consensus:
[
"ey",
"bee"
]
Test Data:
{
"k": [
{
"key": "some value"
},
{
"key": 42
}
],
"kk": [
[
{
"key": 100
},
{
"key": 200
},
{
"key": 300
}
],
[
{
"key": 400
},
{
"key": 500
},
{
"key": 600
}
]
],
"key": [
0,
1
]
}
Selector:
$..[1].key
Consensus:
[
200,
42,
500
]
Test Data:
[
{
"a": 1
},
{
"a": 1
}
]
Selector:
$[*].a
Consensus:
[
1,
1
]
Test Data:
[
{
"a": 1
}
]
Selector:
$[*].a
Consensus:
[
1
]
Test Data:
[
{
"a": 1
},
{
"b": 1
}
]
Selector:
$[*].a
Consensus:
[
1
]
Test Data:
[
{
"id": 42,
"name": "forty-two"
},
{
"id": 1,
"name": "one"
}
]
Selector:
$[?(@.id==42)].name
Consensus:
[
"forty-two"
]
Test Data:
{
"object": {
"key": "value",
"array": [
{
"key": "something"
},
{
"key": {
"key": "russian dolls"
}
}
]
},
"key": "top"
}
Selector:
$..key
Consensus:
[
"russian dolls",
"something",
"top",
"value",
{
"key": "russian dolls"
}
]
Test Data:
{
"store": {
"book": [
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
],
"bicycle": {
"color": "red",
"price": 19.95
}
}
}
Selector:
$.store..price
Consensus:
[
12.99,
19.95,
22.99,
8.95,
8.99
]
Test Data:
[
{
"key": "ey"
},
{
"key": "bee"
},
{
"key": "see"
}
]
Selector:
$[0,2].key
Consensus:
[
"ey",
"see"
]
Test Data:
{
"one": {
"key": "value"
},
"two": {
"k": "v"
},
"three": {
"some": "more",
"key": "other value"
}
}
Selector:
$['one','three'].key
Consensus:
[
"value",
"other value"
]
Test Data:
[
0,
1
]
Selector:
$.key
Consensus:
[]
Test Data:
{
"key": [
"first",
"second"
]
}
Selector:
$.key
Consensus:
[
[
"first",
"second"
]
]
Test Data:
[
{
"id": 2
}
]
Selector:
$.id
Consensus:
[]
Test Data:
{
"key": {}
}
Selector:
$.key
Consensus:
[
{}
]
Test Data:
{
"key": null
}
Selector:
$.key
Consensus:
[
null
]
Test Data:
{
"key": "value"
}
Selector:
$.missing
Consensus:
[]
Test Data:
{
"key-dash": "value"
}
Selector:
$.key-dash
Consensus:
[
"value"
]
Test Data:
{
"in": "value"
}
Selector:
$.in
Consensus:
[
"value"
]
Test Data:
{
"length": "value"
}
Selector:
$.length
Consensus:
[
"value"
]
Test Data:
[
4,
5,
6
]
Selector:
$.length
Consensus:
[]
Test Data:
{
"null": "value"
}
Selector:
$.null
Consensus:
[
"value"
]
Test Data:
{
"true": "value"
}
Selector:
$.true
Consensus:
[
"value"
]
Test Data:
{
"\u5c6c\u6027": "value"
}
Selector:
$.屬性
Consensus:
[
"value"
]
Test Data:
{
"a": "first",
"2": "second",
"b": "third"
}
Selector:
$.2
Consensus:
[
"second"
]
Test Data:
[
{
"bar": [
42
]
}
]
Selector:
$.*.bar.*
Consensus:
[
42
]
Test Data:
[
[
1,
2,
3
],
[
4,
5,
6
]
]
Selector:
$.*.*
Consensus:
[
1,
2,
3,
4,
5,
6
]
Test Data:
{
"key": "value",
"another key": {
"complex": "string",
"primitives": [
0,
1
]
}
}
Selector:
$..*
Consensus:
[
"string",
"value",
0,
1,
[
0,
1
],
{
"complex": "string",
"primitives": [
0,
1
]
}
]
Test Data:
[
40,
null,
42
]
Selector:
$..*
Consensus:
[
40,
42,
null
]
Test Data:
42
Selector:
$..*
Consensus:
[]
Test Data:
[
"string",
42,
{
"key": "value"
},
[
0,
1
]
]
Selector:
$.*
Consensus:
[
"string",
42,
{
"key": "value"
},
[
0,
1
]
]
Test Data:
[]
Selector:
$.*
Consensus:
[]
Test Data:
{}
Selector:
$.*
Consensus:
[]
Test Data:
{
"some": "string",
"int": 42,
"object": {
"key": "value"
},
"array": [
0,
1
]
}
Selector:
$.*
Consensus:
[
"string",
42,
[
0,
1
],
{
"key": "value"
}
]
Filter Expression
- Filter Expression With Bracket Notation
- Filter Expression With Bracket Notation And Current Object Literal
- Filter Expression With Bracket Notation With Number
- Filter Expression With Equals On Array Without Match
- Filter Expression With Equals String With Current Object Literal
- Filter Expression With Equals String With Dot Literal
- Filter Expression With Equals String With Single Quotes
- Filter Expression With Subpaths
Test Data:
[
{
"key": 0
},
{
"key": 42
},
{
"key": -1
},
{
"key": 41
},
{
"key": 43
},
{
"key": 42.0001
},
{
"key": 41.9999
},
{
"key": 100
},
{
"some": "value"
}
]
Selector:
$[?(@['key']==42)]
Consensus:
[
{
"key": 42
}
]
Test Data:
[
{
"@key": 0
},
{
"@key": 42
},
{
"key": 42
},
{
"@key": 43
},
{
"some": "value"
}
]
Selector:
$[?(@['@key']==42)]
Consensus:
[
{
"@key": 42
}
]
Test Data:
[
[
"a",
"b"
],
[
"x",
"y"
]
]
Selector:
$[?(@[1]=='b')]
Consensus:
[
[
"a",
"b"
]
]
Test Data:
[
{
"key": 42
}
]
Selector:
$[?(@.key==43)]
Consensus:
[]
Test Data:
[
{
"key": "some"
},
{
"key": "value"
},
{
"key": "[email protected]"
}
]
Selector:
$[?(@.key=="[email protected]")]
Consensus:
[
{
"key": "[email protected]"
}
]
Test Data:
[
{
"key": "some"
},
{
"key": "value"
},
{
"key": "some.value"
}
]
Selector:
$[?(@.key=="some.value")]
Consensus:
[
{
"key": "some.value"
}
]
Test Data:
[
{
"key": "some"
},
{
"key": "value"
}
]
Selector:
$[?(@.key=='value')]
Consensus:
[
{
"key": "value"
}
]
Test Data:
[
{
"address": {
"city": "Berlin"
}
},
{
"address": {
"city": "London"
}
}
]
Selector:
$[?(@.address.city=='Berlin')]
Consensus:
[
{
"address": {
"city": "Berlin"
}
}
]
Root
Test Data:
{
"key": "value",
"another key": {
"complex": [
"a",
1
]
}
}
Selector:
$
Consensus:
[
{
"another key": {
"complex": [
"a",
1
]
},
"key": "value"
}
]
Test Data:
42
Selector:
$
Consensus:
[
42
]
Test Data:
false
Selector:
$
Consensus:
[
false
]
Test Data:
true
Selector:
$
Consensus:
[
true
]
Union
- Union
- Union With Keys
- Union With Keys After Array Slice
- Union With Keys After Bracket Notation
- Union With Keys On Object Without Key
- Union With Numbers In Decreasing Order
- Union With Spaces
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[0,1]
Consensus:
[
"first",
"second"
]
Test Data:
{
"key": "value",
"another": "entry"
}
Selector:
$['key','another']
Consensus:
[
"value",
"entry"
]
Test Data:
[
{
"c": "cc1",
"d": "dd1",
"e": "ee1"
},
{
"c": "cc2",
"d": "dd2",
"e": "ee2"
}
]
Selector:
$[:]['c','d']
Consensus:
[
"cc1",
"dd1",
"cc2",
"dd2"
]
Test Data:
[
{
"c": "cc1",
"d": "dd1",
"e": "ee1"
},
{
"c": "cc2",
"d": "dd2",
"e": "ee2"
}
]
Selector:
$[0]['c','d']
Consensus:
[
"cc1",
"dd1"
]
Test Data:
{
"key": "value",
"another": "entry"
}
Selector:
$['missing','key']
Consensus:
[
"value"
]
Test Data:
[
1,
2,
3,
4,
5
]
Selector:
$[4,1]
Consensus:
[
5,
2
]
Test Data:
[
"first",
"second",
"third"
]
Selector:
$[ 0 , 1 ]
Consensus:
[
"first",
"second"
]