Filter expression with bracket notation with -1

Setup

Selector: $[?(@[-1]==2)]

[[2, 3], ["a"], [0, 2], [2]]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

Unable to compile selector `$[?(@[-1]==2)]': Invalid array index definition “?(@[-1]==2)]”

Clojure (json-path) ¹

[
  null,
  null,
  null,
  null
]

Cpp (jsoncons)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Dart (json_path)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Elixir (ExJsonPath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Erlang (ejsonpath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[]

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

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Golang (github.com-ohler55-ojg)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Golang (github.com-spyzhov-ajson)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

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

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Haskell (jsonpath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

JavaScript (Goessner) ²

Not found

jsonpath returned false, this might indicate an error

JavaScript (brunerd)

[]

JavaScript (jsonpath)

[]

JavaScript (jsonpath-plus)

[]

JavaScript (jsonpathly)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Java (com.github.jsurfer)

[]

Java (com.jayway.jsonpath) ¹ ³

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  [
    0,
    2
  ],
  [
    2
  ]
]

PHP (galbar-jsonpath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

PHP (remorhaz-jsonpath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

PHP (softcreatr-jsonpath)

[]

Python (jsonpath) ²

[
  [
    0,
    2
  ],
  [
    2
  ]
]

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:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")

Python (python-jsonpath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Raku (JSON-Path)

Not supported

Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)

Ruby (jsonpath)

[
  [
    2,
    3
  ],
  [
    "a"
  ],
  [
    0,
    2
  ],
  [
    2
  ]
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

[]

Rust (jsonpath_plus)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Rust (serde_json_path)

[]

Scala (jsonpath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

Swift (Sextant)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

dotNET (JsonCons.JsonPath)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

dotNET (JsonPath.Net)

[
  [
    0,
    2
  ],
  [
    2
  ]
]

dotNET (JsonPathLib)

[]

dotNET (Manatee.Json)

[]

Errors

Golang (github.com-oliveagle-jsonpath) ¹

interface conversion: interface {} is nil, not string

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

non-safe evaluation, died at main.pl line 11.

dotNET (Json.NET)

Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')

Footnotes