Dot notation with dash

Setup

Selector: $.key-dash

{
  "key": 42,
  "key-": 43,
  "-": 44,
  "dash": 45,
  "-dash": 46,
  "": 47,
  "key-dash": "value",
  "something": "else"
}

Results

Consensus

[
  "value"
]

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

"value"

Other responses

Cpp (jsoncons)

Not supported

Expected '$' or function expression at line 1 and column 6

Dart (json_path)

Not supported

Instance of 'ParserException': end of input expected (at 1:6)

Elixir (ExJsonPath)

Not supported

illegal characters "-d"

Erlang (ejsonpath)

Not supported

syntax error before: '-'

Golang (github.com-PaesslerAG-jsonpath) ¹

Not supported

parsing error: $.key-dash	:1:6 - 1:7 unexpected "-" while scanning operator

Golang (github.com-bhmj-jsonslice) ¹ ³

42

Golang (github.com-ohler55-ojg)

Not supported

JavaScript (brunerd)

Not supported

JavaScript (jsonpath)

Not supported

Lexical error on line 1. Unrecognized text.
$.key-dash
-----^

Python (jsonpath2)

Not supported

line 1:5 token recognition error at: '-d'
ValueError("line 1:5 token recognition error at: '-d'")

Raku (JSON-Path)

Not supported

JSON path parse error at position 5

Rust (serde_json_path)

Not supported

at position 5, parser error

dotNET (JsonCons.JsonPath)

Not supported

Expected '.' or '[' or '^'

dotNET (JsonPath.Net)

Not supported

Could not find any valid selectors.

dotNET (Manatee.Json)

Not supported

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

Footnotes