Filter expression with dot notation with number on array
Setup
Selector: $[?(@.2 == 'third')]
[["first", "second", "third", "forth", "fifth"]]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.2 == 'third')]': Invalid array index definition “?(@.2 == 'third')]”
Clojure (json-path)
¹
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
Cpp (jsoncons)
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
Dart (json_path)
Not supported
end of input expected at 1:2
Elixir (ExJsonPath)
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[]
Erlang (ejsonpath)
Not supported
syntax error before: 2
Not supported
parsing error: $[?(@.2 == 'third')] :1:6 - 1:8 unexpected Float while scanning parentheses expected ")"
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
[]
[]
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
[]
Haskell (jsonpath)
[]
JavaScript (brunerd)
Not supported
Java (com.github.jsurfer)
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
Java (com.jayway.jsonpath)
¹
³
[]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[]
PHP (galbar-jsonpath)
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
PHP (remorhaz-jsonpath)
[]
PHP (softcreatr-jsonpath)
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
Python (jsonpath)
²
[
[
"first",
"second",
"third",
"forth",
"fifth"
]
]
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:6 mismatched input '2' expecting {'*', ID}
ValueError("line 1:6 mismatched input '2' expecting {'*', ID}")
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Rust (jsonpath)
[]
Rust (jsonpath_lib)
[]
Rust (jsonpath_plus)
[]
Scala (jsonpath)
[]
Swift (Sextant)
[]
dotNET (Json.NET)
[]
dotNET (JsonCons.JsonPath)
[]
dotNET (JsonPath.Net)
Not supported
Pattern '(@.2 == 't...' not recognized.
dotNET (Manatee.Json)
[]
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.2 == 'third')]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
[]
Errors
JavaScript (Goessner)
²
jsonPath: Unexpected number: _v.2 == 'third'
JavaScript (jsonpath)
Line 1: Unexpected number
JavaScript (jsonpath-plus)
Unexpected number
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Ruby (jsonpath)
undefined method `2' for ["first", "second", "third", "forth", "fifth"]:Array
dotNET (JsonPathLib)
Line 1: Unexpected number
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.