Array slice with negative step only

Setup

Selector: $[::-2]

["first", "second", "third", "forth", "fifth"]

Results

Other responses

Bash (JSONPath.sh)

[
  "first",
  "second",
  "third",
  "forth",
  "fifth"
]

C (json-glib)

[]

Clojure (json-path) ¹

"forth"

Cpp (jsoncons)

[
  "fifth",
  "third",
  "first"
]

Dart (json_path)

[
  "fifth",
  "third",
  "first"
]

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  "fifth",
  "third",
  "first"
]

Erlang (ejsonpath)

Not supported

syntax error before: ':'

Golang (github.com-PaesslerAG-jsonpath) ¹

[
  "fifth",
  "third",
  "first"
]

Golang (github.com-bhmj-jsonslice) ¹ ³

[
  "fifth",
  "third",
  "first"
]

Golang (github.com-ohler55-ojg)

[]

Golang (github.com-spyzhov-ajson)

[
  "fifth",
  "third",
  "first"
]

Golang (github.com-vmware-labs-yaml-jsonpath)

[
  "fifth",
  "third",
  "first"
]

Haskell (jsonpath)

[
  "fifth",
  "third",
  "first"
]

JavaScript (Goessner) ²

Not found

jsonpath returned false, this might indicate an error

JavaScript (brunerd)

[
  "fifth",
  "third",
  "first"
]

JavaScript (jsonpath)

[
  "fifth",
  "third",
  "first"
]

JavaScript (jsonpath-plus)

[]

JavaScript (jsonpathly)

[
  "first",
  "second",
  "third",
  "forth",
  "fifth"
]

Java (com.github.jsurfer)

Not supported

org.antlr.v4.runtime.misc.ParseCancellationException

Java (com.jayway.jsonpath) ¹ ³

Not supported

SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
com.jayway.jsonpath.InvalidPathException: Failed to parse SliceOperation: ::-2

Kotlin (com.nfeld.jsonpathkt) ¹

[
  "first",
  "second",
  "third"
]

Objective-C (SMJJSONPath) ¹ ³

Not supported

Failed to parse SliceOperation: ::-2

PHP (galbar-jsonpath)

[
  "fifth",
  "third",
  "first"
]

PHP (remorhaz-jsonpath)

[
  "fifth",
  "third",
  "first"
]

Perl (JSON-Path)

[
  "fifth",
  "forth",
  "third",
  "second",
  "first"
]

Python (jsonpath) ²

Not found

jsonpath returned false, this might indicate an error

Python (jsonpath-ng)

Not supported

JsonPathParserError('Parse error at 1:3 near token : (:)')

Python (jsonpath-rw)

Not supported

Exception('Parse error at 1:3 near token : (:)')

Python (jsonpath2)

[]

Python (python-jsonpath)

[
  "fifth",
  "third",
  "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: 
$[::-2]
^^^^

Rust (jsonpath_plus)

[
  "fifth",
  "third",
  "first"
]

Rust (serde_json_path)

[
  "fifth",
  "third",
  "first"
]

Scala (jsonpath)

[
  "fifth",
  "third",
  "first"
]

Swift (Sextant)

[
  "first",
  "second",
  "third",
  "forth",
  "fifth"
]

dotNET (Json.NET)

[
  "fifth",
  "third",
  "first"
]

dotNET (JsonCons.JsonPath)

[
  "fifth",
  "third",
  "first"
]

dotNET (JsonPath.Net)

[
  "fifth",
  "third",
  "first"
]

dotNET (JsonPathLib)

[]

dotNET (Manatee.Json)

[]

Errors

Elixir (ExJsonPath)

FunctionClauseError

Golang (github.com-oliveagle-jsonpath) ¹

only support one range(from, to): [  -2]

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