Bracket notation with number on string
Setup
Selector: $[0]
"Hello World"
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
JavaScript (Goessner)
²
[
"H"
]
JavaScript (jsonpath-plus)
[
"H"
]
Kotlin (com.nfeld.jsonpathkt)
¹
"H"
Python (jsonpath-ng)
[
"H"
]
Python (jsonpath-rw)
[
"H"
]
Errors
Clojure (json-path)
¹
java.lang.Exception object must be an array.
Elixir (jaxon)
** (Jaxon.ParseError) Unexpected string "Hello World", expected a string, number, object, array instead.
lib/jaxon/decoders/query.ex:29: anonymous fn/2 in Jaxon.Decoders.Query.query/2
lib/jsonpath.ex:8: Mix.Tasks.Execute.run/1
Elixir (warpath)
¹
Warpath.JsonDecodeError
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}
unsupported value type string for select, expected map[string]interface{} or []interface{}
object is not Slice
JavaScript (jsonpath)
obj needs to be an object
Perl (JSON-Path)
Unable to decode Hello World as JSON: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "Hello World") at build/lib/perl5/JSON/Path/Evaluator.pm line 77.
at build/lib/perl5/JSON/Path/Evaluator.pm line 75.
Python (python-jsonpath)
Invalid JSON document - Expecting value: line 1 column 1 (char 0)
Raku (JSON-Path)
at 0: expected a json object, but got '"Hello Wo"'
Ruby (jsonpath)
unexpected token at 'Hello World'
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.