Bracket notation with spaces

Setup

Selector: $[ 'a' ]

{" a": 1, "a": 2, " a ": 3, "a ": 4, " 'a' ": 5, " 'a": 6, "a' ": 7, " \"a\" ": 8, "\"a\"": 9}

Results

Consensus

[
  2
]

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).

2

Other responses

C (json-glib)

Not supported

Unable to compile selector `$[ 'a' ]': Invalid array index definition “ 'a' ]”

Elixir (jaxon)

[
  5
]

Golang (github.com-spyzhov-ajson)

[
  5
]

JavaScript (Goessner) ²

[
  5
]

JavaScript (jsonpath)

Not supported

Lexical error on line 1. Unrecognized text.
$[ 'a' ]
--^

JavaScript (jsonpath-plus)

[
  5
]

PHP (Goessner) ²

[
  5
]

PHP (galbar-jsonpath)

Not supported

Invalid JSONPath error: 'Error in JSONPath near ' 'a' ''

Perl (JSON-Path)

[]

Python (jsonpath) ²

[
  5
]

Python (jsonpath2)

Not supported

line 1:3 token recognition error at: '''
ValueError("line 1:3 token recognition error at: '''")

Raku (JSON-Path)

Not supported

JSON path parse error at position 1

Rust (jsonpath)

Not supported

parsing error

dotNET (JsonPathLib)

[
  5
]

dotNET (Manatee.Json)

Not supported

Unrecognized JSON Path element. Path up to error: '$'

Errors

Clojure (json-path) ¹

java.lang.Exception object must be an array.

Golang (github.com-oliveagle-jsonpath) ¹

strconv.Atoi: parsing "'a'": invalid syntax

Ruby (jsonpath)

invalid value for Integer(): " 'a' "

Footnotes