Array slice on object
Setup
Selector: $[1:3]
{":": 42, "more": "string", "a": 1, "b": 2, "c": 3, "1:3": "nice"}
Results
Consensus
[]
Other responses
Elixir (jaxon)
[
"nice"
]
JavaScript (Goessner)
²
[
"nice"
]
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: Filter: [1:3] can only be applied to arrays. Current context is: {:=42, more=string, a=1, b=2, c=3, 1:3=nice}
Objective-C (SMJJSONPath)
¹
³
Not found
Filter: [1:3] can only be applied to arrays. Current context is: {"1:3" = nice; ":" = 42; a = 1; b = 2; c = 3; more = string; }
PHP (Goessner)
²
[
"nice"
]
Python (jsonpath)
²
[
"nice"
]
Ruby (jsonpath)
[
null,
null
]
dotNET (JsonPathLib)
[
"nice"
]
dotNET (Manatee.Json)
[
"string",
1
]
Errors
Clojure (json-path)
¹
java.lang.Exception object must be an array.
Elixir (ExJsonPath)
Invalid object returned
Erlang (ejsonpath)
init terminating in do_boot (not_implemented)
Crash dump is being written to: /dev/null...done
{"init terminating in do_boot",not_implemented}
object is not Slice
PHP (softcreatr-jsonpath)
TypeError
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.