Union with keys after recursive descent
Setup
Selector: $..['c','d']
[{"c":"cc1","d":"dd1","e":"ee1"}, {"c": "cc2", "child": {"d": "dd2"}}, {"c": "cc3"}, {"d": "dd4"}, {"child": {"c": "cc5"}}]
Results
Consensus
[
"cc1",
"cc2",
"cc3",
"cc5",
"dd1",
"dd2",
"dd4"
]
Other responses
C (json-glib)
Not supported
Unable to compile selector `$..['c','d']': Missing member name or wildcard after . character
Elixir (ExJsonPath)
Not supported
syntax error before: '['
Elixir (jaxon)
[]
Elixir (warpath) ¹
Not supported
Parser error: Invalid token on line 1, syntax error before: <<",">>
Erlang (ejsonpath)
Not supported
syntax error before: '['
Golang (github.com-bhmj-jsonslice) ¹ ³
[
"cc1",
"cc2"
]
Golang (github.com-vmware-labs-yaml-jsonpath)
Not supported
child name or array access or filter missing after recursive descent at position 3, following "$.."
JavaScript (jsonpath-plus)
[]
Java (com.jayway.jsonpath) ¹ ³
[
{
"c": "cc1",
"d": "dd1"
}
]
Objective-C (SMJJSONPath) ¹ ³
[
{
"c": "cc1",
"d": "dd1"
}
]
Perl (JSON-Path)
[]
Python (jsonpath2)
Not supported
line 1:4 token recognition error at: '''
ValueError("line 1:4 token recognition error at: '''")
Raku (JSON-Path)
Not supported
JSON path parse error at position 3
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
[]
Scala (jsonpath)
Not supported
JPError(end of input expected)
dotNET (Manatee.Json)
Not supported
Expected close bracket. Path up to error: '$..'''
Errors
Clojure (json-path) ¹
java.lang.NumberFormatException For input string: "c"
Golang (github.com-oliveagle-jsonpath) ¹
strconv.Atoi: parsing "'c'": invalid syntax
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.