Array slice with open end and negative step
Setup
Selector: $[3::-1]
["first", "second", "third", "forth", "fifth"]
Results
Other responses
Bash (JSONPath.sh)
[
"forth",
"fifth"
]
C (json-glib)
[]
Clojure (json-path)
¹
"forth"
Cpp (jsoncons)
[
"forth",
"third",
"second",
"first"
]
Dart (json_path)
[
"forth",
"third",
"second",
"first"
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
"third",
"second",
"first"
]
Erlang (ejsonpath)
Not supported
syntax error before: ':'
[
"fifth",
"forth"
]
[
"forth",
"third",
"second",
"first"
]
[]
[
"forth",
"third",
"second",
"first"
]
[
"forth",
"third",
"second",
"first"
]
Haskell (jsonpath)
[
"forth",
"third",
"second",
"first"
]
JavaScript (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
JavaScript (brunerd)
[
"forth",
"third",
"second",
"first"
]
JavaScript (jsonpath)
[
"forth",
"third",
"second",
"first"
]
JavaScript (jsonpath-plus)
[]
JavaScript (jsonpathly)
[
"forth",
"fifth"
]
Java (com.github.jsurfer)
Not supported
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.jayway.jsonpath)
¹
³
[
"forth",
"fifth"
]
Kotlin (com.nfeld.jsonpathkt)
¹
[
"forth"
]
Objective-C (SMJJSONPath)
¹
³
[
"forth",
"fifth"
]
PHP (galbar-jsonpath)
[
"forth",
"third",
"second",
"first"
]
PHP (remorhaz-jsonpath)
[
"forth",
"third",
"second",
"first"
]
Perl (JSON-Path)
[
"fifth",
"forth"
]
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Python (jsonpath-ng)
Not supported
JsonPathParserError('Parse error at 1:4 near token : (:)')
Python (jsonpath-rw)
Not supported
Exception('Parse error at 1:4 near token : (:)')
Python (jsonpath2)
[]
Python (python-jsonpath)
[
"forth",
"third",
"second",
"first"
]
Raku (JSON-Path)
Not supported
JSON path parse error at position 1
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[3::-1]
^^^^^
Rust (jsonpath_plus)
[
"fifth",
"forth"
]
Rust (serde_json_path)
[
"forth",
"third",
"second",
"first"
]
Scala (jsonpath)
[
"forth",
"third",
"second",
"first"
]
Swift (Sextant)
[
"forth",
"fifth"
]
dotNET (Json.NET)
[
"forth",
"third",
"second",
"first"
]
dotNET (JsonCons.JsonPath)
[
"forth",
"third",
"second",
"first"
]
dotNET (JsonPath.Net)
[
"forth",
"third",
"second",
"first"
]
dotNET (JsonPathLib)
[]
dotNET (Manatee.Json)
[]
Errors
Elixir (ExJsonPath)
FunctionClauseError
only support one range(from, to): [3 -1]
PHP (Goessner)
²
timeout: sending signal TERM to command ‘implementations/PHP_Goessner/run.sh’
PHP (softcreatr-jsonpath)
timeout: sending signal TERM to command ‘php’
Ruby (jsonpath)
step can't be negative
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.