Array slice with step and leading zeros
Setup
Selector: $[010:024:010]
[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
Results
Other responses
Bash (JSONPath.sh)
[
8,
16
]
C (json-glib)
[
10,
20
]
Clojure (json-path)
¹
10
Cpp (jsoncons)
[
8,
16
]
Dart (json_path)
Not supported
Instance of 'ParserException': end of input expected (at 1:2)
Elixir (ExJsonPath)
[
10,
20
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
10,
20
]
Erlang (ejsonpath)
[
10,
20
]
[
10,
20
]
[
10,
20
]
[
10,
20
]
[
10,
20
]
Not supported
jsonpath: invalid number literal at position 3
[
10,
20
]
Haskell (jsonpath)
[
10,
20
]
JavaScript (Goessner)
²
[
10,
20
]
JavaScript (jsonpath)
Not supported
Parse error on line 1:
$[010:024:010]
---^
Expecting ']', ',', got 'ARRAY_SLICE'
JavaScript (jsonpath-plus)
[
10,
20
]
JavaScript (jsonpathly)
[
10,
20
]
Java (com.github.jsurfer)
Not supported
line 1:2 no viable alternative at input '[010'
org.antlr.v4.runtime.misc.ParseCancellationException
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>4</column><pos>4</pos><unexpected>1</unexpected><permitted>#9, #A, #D, ' '</permitted><could-be-next><in rule="B"><tokens>#9, #A, #D, ' '</tokens></in></could-be-next><unfinished><open rule="bracketed-selection" start="2" end="3"><input>[0</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>4</column><pos>4</pos><unexpected>1</unexpected><permitted>#9, #A, #D, ' '</permitted><could-be-next><in rule="B"><tokens>#9, #A, #D, ' '</tokens></in></could-be-next><unfinished><open rule="bracketed-selection" start="2" end="3"><input>[0</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>
Java (com.jayway.jsonpath)
¹
³
[
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
]
Kotlin (com.nfeld.jsonpathkt)
¹
[
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
]
Objective-C (SMJJSONPath)
¹
³
[
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
]
PHP (Goessner)
²
[
20
]
PHP (galbar-jsonpath)
[
10,
20
]
PHP (remorhaz-jsonpath)
Not supported
Error: 'Failed to build AST from JSONPath query: $[010:024:010]'
PHP (softcreatr-jsonpath)
[
10,
20
]
Perl (JSON-Path)
[
10,
20
]
Python (jsonpath)
²
[
10,
20
]
Python (jsonpath-ng)
[
10,
20
]
Python (jsonpath-rw)
Not supported
Exception('Parse error at 1:9 near token : (:)')
Python (jsonpath2)
Not supported
line 1:3 mismatched input '10' expecting {']', ','}
ValueError("line 1:3 mismatched input '10' expecting {']', ','}")
Python (python-jsonpath)
Not supported
JSONPathSyntaxError("invalid index '010'")
Raku (JSON-Path)
Not supported
JSON path parse error at position 1
Ruby (jsonpath)
[
8,
16
]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
[
10,
20
]
Rust (jsonpath_plus)
[
10,
20
]
Rust (serde_json_path)
Not supported
at position 3, in long-hand segment, expected closing ']'
Scala (jsonpath)
[
10,
20
]
Swift (Sextant)
[
10,
20
]
dotNET (Json.NET)
[
10,
20
]
dotNET (JsonCons.JsonPath)
[
10,
20
]
dotNET (JsonPath.Net)
Not supported
Pattern '010:024:01...' not recognized.
dotNET (JsonPathLib)
[
10,
20
]
dotNET (Manatee.Json)
[
10,
20
]
Errors
only support one range(from, to): [010 024 010]
JavaScript (brunerd)
Octal indices are disallowed: 010
JavaScript (json-p3)
leading zero in index selector ('$[010:024':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.