Array slice on object
Setup
Selector: $[1:3]
{":": 42, "more": "string", "a": 1, "b": 2, "c": 3, "1:3": "nice"}
Results
Consensus
[]
Not found consensus
This consensus applies for implementations which return a specific not found value if no match exists.
NOT_FOUND
Other responses
Elixir (jaxon)
[
"nice"
]
JavaScript (Goessner)
²
[
"nice"
]
Java (com.jayway.jsonpath)
¹
³
Not found
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder 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.