Filter expression with equals object
Setup
Selector: $[?(@.d=={"k":"v"})]
[
{
"d": {
"k": "v"
}
},
{
"d": {
"a": "b"
}
},
{
"d": "k"
},
{
"d": "v"
},
{
"d": {}
},
{
"d": []
},
{
"d": null
},
{
"d": -1
},
{
"d": 0
},
{
"d": 1
},
{
"d": "[object Object]"
},
{
"d": "{\"k\": \"v\"}"
},
{
"d": "{\"k\":\"v\"}"
},
"v"
]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.d=={"k":"v"})]': Invalid array index definition “?(@.d=={"k":"v"})]”
Clojure (json-path)
¹
[
{
"d": null
},
"v"
]
Cpp (jsoncons)
[
{
"d": {
"k": "v"
}
}
]
Dart (json_path)
Not supported
end of input expected at 1:2
Elixir (ExJsonPath)
Not supported
illegal characters "{"
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Parser error: Invalid token on line 1, syntax error before: <<"k">>
Not supported
parsing error: $[?(@.d=={"k":"v"})] :1:10 - 1:11 unexpected "{" while scanning extensions
Not supported
[]
Not supported
invalid filter term at position 9, following "=="
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.d=={"k":"v"})]
Error: 1:10:
|
1 | $[?(@.d=={"k":"v"})]
| ^^^^^
unexpected "{"k":"
expecting "false", "null", "true", '!', '"', '$', ''', '@', digit, or white space
JavaScript (Goessner)
²
[
{
"d": "[object Object]"
}
]
JavaScript (brunerd)
[]
JavaScript (jsonpath)
[
{
"d": "[object Object]"
}
]
JavaScript (jsonpath-plus)
[
{
"d": "[object Object]"
}
]
Java (com.github.jsurfer)
Not supported
line 1:9 no viable alternative at input '@.d=={'
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.jayway.jsonpath)
¹
³
[
{
"d": {
"k": "v"
}
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"d": {
"k": "v"
}
}
]
PHP (galbar-jsonpath)
[
"v"
]
PHP (remorhaz-jsonpath)
Not supported
Error: 'Failed to build AST from JSONPath query: $[?(@.d=={"k":"v"})]'
PHP (softcreatr-jsonpath)
[
{
"d": "{\"k\":\"v\"}"
}
]
Python (jsonpath)
²
[
{
"d": {
"k": "v"
}
}
]
Python (jsonpath-ng)
Not supported
JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')
Python (jsonpath-rw)
Not supported
JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')
Python (jsonpath2)
Not supported
line 1:8 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:8 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?(@.d=={"k":"v"})]
^^^^^^^^^^^^^
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
[
{
"d": {
"k": "v"
}
},
{
"d": "{\"k\":\"v\"}"
}
]
dotNET (Json.NET)
Not supported
Unexpected character while parsing path query: {
dotNET (JsonCons.JsonPath)
[
{
"d": {
"k": "v"
}
}
]
dotNET (JsonPath.Net)
[
{
"d": {
"k": "v"
}
}
]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.d=={"k":"v"})]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
Not supported
x 1:10-1:10 DocumentValue
| $[?(@.d=={"k":"v"})]
| ^
| x 1:10-1:10 IntegerPart
| | $[?(@.d=={"k":"v"})]
| | ^
| x 1:10-1:10 Number
| | $[?(@.d=={"k":"v"})]
| | ^
| x 1:10-1:10 SimpleValue
| | $[?(@.d=={"k":"v"})]
| | ^
| |
|/
x 1:10-1:10 FilterValue
| $[?(@.d=={"k":"v"})]
| ^
o 1:5-1:8 HigherPrecedenceFilterExpression
| $[?(@.d=={"k":"v"})]
| ^^^
x 1:5-1:5 LogicalOr
| $[?(@.d=={"k":"v"})]
| ^
| x 1:10-1:10 DocumentValue
| | $[?(@.d=={"k":"v"})]
| | ^
| | x 1:10-1:10 IntegerPart
| | | $[?(@.d=={"k":"v"})]
| | | ^
| | x 1:10-1:10 Number
| | | $[?(@.d=={"k":"v"})]
| | | ^
| | x 1:10-1:10 SimpleValue
| | | $[?(@.d=={"k":"v"})]
| | | ^
| | |
| |/
| x 1:10-1:10 FilterValue
| | $[?(@.d=={"k":"v"})]
| | ^
| o 1:5-1:8 HigherPrecedenceFilterExpression
| | $[?(@.d=={"k":"v"})]
| | ^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.d=={"k":"v"})]
| | ^
| | x 1:10-1:10 DocumentValue
| | | $[?(@.d=={"k":"v"})]
| | | ^
| | | x 1:10-1:10 IntegerPart
| | | | $[?(@.d=={"k":"v"})]
| | | | ^
| | | x 1:10-1:10 Number
| | | | $[?(@.d=={"k":"v"})]
| | | | ^
| | | x 1:10-1:10 SimpleValue
| | | | $[?(@.d=={"k":"v"})]
| | | | ^
| | | |
| | |/
| | x 1:10-1:10 FilterValue
| | | $[?(@.d=={"k":"v"})]
| | | ^
| | o 1:5-1:8 HigherPrecedenceFilterExpression
| | | $[?(@.d=={"k":"v"})]
| | | ^^^
| | |
|/ /
| |
|/
o 1:5-1:8 FilterExpression
| $[?(@.d=={"k":"v"})]
| ^^^
x 1:3-1:3 BracketElement
| $[?(@.d=={"k":"v"})]
| ^
x 1:3-1:3 BracketElements
| $[?(@.d=={"k":"v"})]
| ^
x 1:2-1:2 BracketChildren
| $[?(@.d=={"k":"v"})]
| ^
x 1:2-1:2 Operator
| $[?(@.d=={"k":"v"})]
| ^
o 1:1-1:2 Start
$[?(@.d=={"k":"v"})]
^
Errors
Erlang (ejsonpath)
Timeout
unknown token at 5: {"k":"v"} at 4
wrong request: wrong request: ?(@.d=={"k":"v"})
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?(@.d=={"k":"v"})]
panic occurred
dotNET (JsonPathLib)
Object reference not set to an instance of an object.
Footnotes
- ¹ This implementation returns a single value where only one match is possible (instead of an array of a single value).
- ² This implementation returns a specific not found value if no match exists.
- ³ This implementation returns a specific not found value if a query that would regularly return a single match results in no match.