Dot notation with number -1

Setup

Selector: $.-1

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

Results

Consensus

[]

Scalar consensus

The scalar consensus applies for implementations which return a single value where only one match is possible (instead of an array of a single value).

null

Not found consensus

This consensus applies for implementations which return a specific not found value if no match exists.

NOT_FOUND

Scalar not found consensus

This consensus applies for implementations which returns a specific not found value when a query that would regularly return a single match results in no match.

NOT_FOUND

Other responses

Cpp (jsoncons)

Not supported

Expected '$' or function expression at line 1 and column 3

Elixir (ExJsonPath)

[
  "fifth"
]

Erlang (ejsonpath)

Not supported

syntax error before: '-'

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $.-1	:1:3 - 1:4 unexpected "-" while scanning JSON select expected Ident, "." or "*"

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

"fifth"

Golang (github.com-ohler55-ojg)

Not supported

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  "fifth"
]

JavaScript (brunerd)

Not supported

PHP (galbar-jsonpath) ²

Not supported

Invalid JSONPath error: 'Error in JSONPath near '.-1''

PHP (remorhaz-jsonpath)

Not supported

Error: 'Failed to build AST from JSONPath query: $.-1'

PHP (softcreatr-jsonpath)

[
  "fifth"
]

Perl (JSON-Path)

[
  "fifth"
]

Python (jsonpath-ng)

Not supported

JsonPathParserError('Parse error at 1:2 near token -1 (NUMBER)')

Python (jsonpath-rw)

Not supported

Exception('Parse error at 1:2 near token -1 (NUMBER)')

Python (jsonpath2)

Not supported

line 1:2 mismatched input '-1' expecting {'*', ID}
ValueError("line 1:2 mismatched input '-1' expecting {'*', ID}")

Raku (JSON-Path)

Not supported

JSON path parse error at position 1

dotNET (JsonCons.JsonPath)

Not supported

Expected unquoted string, or single or double quoted string, or index or '*'

dotNET (JsonPath.Net)

Not supported

Could not find any valid selectors.

dotNET (Manatee.Json)

Not supported

Unrecognized JSON Path element. Path up to error: '$'

Footnotes