Dot notation with number -1
Setup
Selector: $.-1
["first", "second", "third", "forth", "fifth"]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
[]
Clojure (json-path)
¹
null
Cpp (jsoncons)
Not supported
Expected '$' or function expression at line 1 and column 3
Dart (json_path)
Not supported
ParserException[1:2]: end of input expected
Elixir (ExJsonPath)
[
"fifth"
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
null
Erlang (ejsonpath)
Not supported
syntax error before: '-'
FSharp (FSharp.Data.JsonPath)
[]
Not supported
parsing error: $.-1 :1:3 - 1:4 unexpected "-" while scanning JSON select expected Ident, "." or "*"
"fifth"
Not supported
[]
[
"fifth"
]
Not supported
jsonpath: unexpected integer at position 3
[]
Haskell (jsonpath)
[]
JavaScript (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
JavaScript (brunerd)
Not supported
JavaScript (jsonpath)
[]
JavaScript (jsonpath-plus)
[]
JavaScript (jsonpathly)
[
"fifth"
]
Java (com.github.jsurfer)
[]
Java (com.github.xmljacquard.ajp)
Not supported
Error at char 18 in expression in xsl:sequence/@select on line 20 column 67 of ajp-runner.xslt:
<failed xmlns:ixml="http://invisiblexml.org/NS"
ixml:state="failed"><line>1</line><column>3</column><pos>3</pos><unexpected>-</unexpected><permitted>'*', '_', [#80-'[xd7ff]'], ['A'-'Z'; 'a'-'z'], ['𐀀[x10000]'-'[x10ffef]'], ['[xe000]'-'[xffef]']</permitted><could-be-next><in rule="ALPHA"><tokens>['A'-'Z'; 'a'-'z']</tokens></in><in rule="wildcard-selector"><tokens>'*'</tokens></in><in rule="name-first"><tokens>'_', [#80-'[xd7ff]'], ['𐀀[x10000]'-'[x10ffef]'], ['[xe000]'-'[xffef]']</tokens></in></could-be-next><unfinished><open rule="child-segment" start="2" end="2"><input>.</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>
During lazy evaluation of tailCallLoop(ajp:getProcessor(...)) on line 20 of jar:file:./implementations/Java_com.github.xmljacquard.ajp/build/deps/org/xmljacquard/ajp/0.0.7/ajp-0.0.7.jar!/xslt/ajp-runner.xslt
In function ajpr:getProcessor on line 17 column 106 of ajp-runner.xslt:
net.sf.saxon.s9api.SaxonApiException: <failed xmlns:ixml="http://invisiblexml.org/NS" ixml:state="failed"><line>1</line><column>3</column><pos>3</pos><unexpected>-</unexpected><permitted>'*', '_', [#80-''], ['A'-'Z'; 'a'-'z'], ['𐀀'-''], [''-'']</permitted><could-be-next><in rule="ALPHA"><tokens>['A'-'Z'; 'a'-'z']</tokens></in><in rule="wildcard-selector"><tokens>'*'</tokens></in><in rule="name-first"><tokens>'_', [#80-''], ['𐀀'-''], [''-'']</tokens></in></could-be-next><unfinished><open rule="child-segment" start="2" end="2"><input>.</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>
Java (com.jayway.jsonpath)
¹
³
Not found
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.PathNotFoundException: Expected to find an object with property ['-1'] in path $ but found 'net.minidev.json.JSONArray'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JsonSmartJsonProvider'.
Kotlin (com.nfeld.jsonpathkt)
¹
null
Objective-C (SMJJSONPath)
¹
³
Not found
Expected to find an object with property ['-1'] in path $ but found 'GSArray'. This is not a json object.
PHP (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
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)
²
Not found
jsonpath returned false, this might indicate an error
Python (jsonpath-ng)
[]
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}")
Python (python-jsonpath)
Not supported
JSONPathSyntaxError('expected a shorthand selector')
Raku (JSON-Path)
Not supported
JSON path parse error at position 1
Ruby (janeway-jsonpath)
Not supported
Jsonpath query $.-1 - Dot "." begins a name selector, and must be followed by an object member name, "-" is invalid here
Ruby (jsonpath)
[]
Rust (jsonpath)
[]
Rust (jsonpath_lib)
[]
Rust (jsonpath_plus)
[]
Rust (serde_json_path)
Not supported
at position 2, in dot member name, must start with lowercase alpha or '_'
Scala (jsonpath)
[]
Swift (Sextant)
[]
dotNET (Json.NET)
[]
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 (JsonPathLib)
[]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path element. Path up to error: '$'
Errors
JavaScript (json-p3)
unexpected shorthand selector '-' ('$.-1':2)
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.