Filter expression with subpaths deeply nested
Setup
Selector: $[?(@.a.b.c==3)]
[{"a": {"b": {"c": 3}}}, {"a": 3}, {"c": 3}, {"a": {"b": {"c": 2}}}]
Results
Consensus
[
{
"a": {
"b": {
"c": 3
}
}
}
]
Other responses
Bash (JSONPath.sh)
[
3
]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.a.b.c==3)]': Invalid array index definition “?(@.a.b.c==3)]”
Clojure (json-path)
¹
[
{
"a": 3
},
{
"c": 3
}
]
Elixir (jaxon)
[]
[]
JavaScript (brunerd)
Not supported
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
PHP (softcreatr-jsonpath)
[]
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:12 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:12 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)
Rust (jsonpath)
[]
Rust (jsonpath_lib)
[]
Errors
JavaScript (Goessner)
²
jsonPath: Cannot read property 'c' of undefined: _v.a.b.c==3
JavaScript (jsonpath-plus)
jsonPath: Cannot read property 'c' of undefined: @.a.b.c==3
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
dotNET (JsonPathLib)
Cannot read property 'b' of undefined
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.