Bracket notation after recursive descent
Setup
Selector: $..[0]
[
"first",
{
"key": [
"first nested",
{
"more": [
{
"nested": ["deepest", "second"]
},
["more", "values"]
]
}
]
}
]
Results
Consensus
[
"deepest",
"first nested",
"first",
"more",
{
"nested": [
"deepest",
"second"
]
}
]
Other responses
Bash (JSONPath.sh)
[
"deepest",
"first nested",
"more",
"second"
]
C (json-glib)
Not supported
Unable to compile selector `$..[0]': Missing member name or wildcard after . character
Elixir (ExJsonPath)
Not supported
syntax error before: '['
Elixir (jaxon)
[
"first"
]
Erlang (ejsonpath)
Not supported
syntax error before: '['
PHP (galbar-jsonpath)
²
Not supported
Invalid JSONPath error: 'Error in JSONPath near '..[0]''
Perl (JSON-Path)
[]
Raku (JSON-Path)
[
"deepest",
"first nested",
"more",
{
"nested": [
"deepest",
"second"
]
}
]
Rust (jsonpath)
Not supported
parsing error
Scala (jsonpath)
Not supported
JPError(end of input expected)
dotNET (Json.NET)
[
"first"
]
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $..[0]
| ^---
|
= expected childName
Errors
Clojure (json-path)
¹
java.lang.Exception object must be an array.
expression don't support in filter
PHP (softcreatr-jsonpath)
TypeError
Python (jsonpath-ng)
KeyError(0)
Python (jsonpath-rw)
KeyError(0)
Ruby (jsonpath)
0 is not a symbol nor a string
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.