Filter expression with equals number with leading zeros

Setup

Selector: $[?(@.key==010)]

[{"key": "010"}, {"key": "10"}, {"key": 10}, {"key": 0}, {"key": 8}]

Results

Other responses

Bash (JSONPath.sh)

[
  "010"
]

C (json-glib)

Not supported

Unable to compile selector `$[?(@.key==010)]': Invalid array index definition “?(@.key==010)]”

Clojure (json-path) ¹

[]

Cpp (jsoncons)

Not supported

A number cannot have a leading zero at line 1 and column 15

Dart (json_path)

[
  {
    "key": 10
  }
]

Elixir (ExJsonPath)

[
  {
    "key": 10
  }
]

Elixir (jaxon)

[]

Elixir (warpath) ¹

[
  {
    "key": 10
  }
]

Erlang (ejsonpath)

[
  {
    "key": 10
  }
]

Golang (github.com-PaesslerAG-jsonpath) ¹

[
  {
    "key": 10
  }
]

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

[
  {
    "key": "010"
  },
  {
    "key": "10"
  },
  {
    "key": 10
  }
]

Golang (github.com-ohler55-ojg)

[
  {
    "key": 10
  }
]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-vmware-labs-yaml-jsonpath)

[
  {
    "key": 10
  }
]

Haskell (jsonpath)

[
  {
    "key": 10
  }
]

JavaScript (Goessner) ²

[
  {
    "key": 8
  }
]

JavaScript (brunerd)

[
  {
    "key": 8
  }
]

JavaScript (jsonpath)

[
  {
    "key": 8
  }
]

JavaScript (jsonpath-plus)

[
  {
    "key": 8
  }
]

Java (com.github.jsurfer)

Not supported

line 1:11 no viable alternative at input '@.key==010'
org.antlr.v4.runtime.misc.ParseCancellationException

Java (com.jayway.jsonpath) ¹ ³

[
  {
    "key": "10"
  },
  {
    "key": 10
  }
]

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

[
  {
    "key": "010"
  },
  {
    "key": "10"
  },
  {
    "key": 10
  }
]

PHP (galbar-jsonpath) ²

[
  {
    "key": 10
  }
]

PHP (remorhaz-jsonpath)

Not supported

Error: 'Failed to build AST from JSONPath query: $[?(@.key==010)]'

PHP (softcreatr-jsonpath)

[
  {
    "key": "010"
  },
  {
    "key": "10"
  },
  {
    "key": 10
  }
]

Python (jsonpath) ²

Not found

jsonpath returned false, this might indicate an error

Python (jsonpath-ng)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath-rw)

Not supported

JsonPathLexerError('Error on line 1, col 2: Unexpected character: ? ')

Python (jsonpath2)

Not supported

line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:10 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")

Raku (JSON-Path)

Not supported

Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)

Ruby (jsonpath)

[
  {
    "key": "010"
  },
  {
    "key": "10"
  },
  {
    "key": 10
  }
]

Rust (jsonpath)

[]

Rust (jsonpath_lib)

[
  {
    "key": 10
  }
]

Rust (jsonpath_plus)

[
  {
    "key": 10
  }
]

Scala (jsonpath)

[
  {
    "key": 10
  }
]

Swift (Sextant)

[
  {
    "key": "010"
  },
  {
    "key": "10"
  },
  {
    "key": 10
  }
]

dotNET (Json.NET)

[
  {
    "key": 10
  }
]

dotNET (JsonCons.JsonPath)

Not supported

Invalid JSON literal

dotNET (JsonPath.Net)

[
  {
    "key": 10
  }
]

dotNET (JsonPathLib)

[
  {
    "key": 8
  }
]

dotNET (Manatee.Json)

[
  {
    "key": 10
  }
]

JSON (Path_Reference_Implementation)

Not supported

 --> 1:3
  |
1 | $[?(@.key==010)]
  |   ^---
  |
  = expected unionChild, unionArrayIndex, or sliceStart

Proposal (A)

Not supported


x 1:13-1:13 Exponent
| $[?(@.key==010)]
|             ^
| x 1:13-1:13 Fraction
| | $[?(@.key==010)]
| |             ^
| | 
|/  
o 1:12-1:13 Number
| $[?(@.key==010)]
|            ^
o 1:12-1:13 SimpleValue
| $[?(@.key==010)]
|            ^
o 1:12-1:13 FilterValue
| $[?(@.key==010)]
|            ^
o 1:5-1:13 HigherPrecedenceFilterExpression
| $[?(@.key==010)]
|     ^^^^^^^^
x 1:5-1:5 LogicalOr
| $[?(@.key==010)]
|     ^
| x 1:13-1:13 Exponent
| | $[?(@.key==010)]
| |             ^
| | x 1:13-1:13 Fraction
| | | $[?(@.key==010)]
| | |             ^
| | | 
| |/  
| o 1:12-1:13 Number
| | $[?(@.key==010)]
| |            ^
| o 1:12-1:13 SimpleValue
| | $[?(@.key==010)]
| |            ^
| o 1:12-1:13 FilterValue
| | $[?(@.key==010)]
| |            ^
| o 1:5-1:13 HigherPrecedenceFilterExpression
| | $[?(@.key==010)]
| |     ^^^^^^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.key==010)]
| |     ^
| | x 1:13-1:13 Exponent
| | | $[?(@.key==010)]
| | |             ^
| | | x 1:13-1:13 Fraction
| | | | $[?(@.key==010)]
| | | |             ^
| | | | 
| | |/  
| | o 1:12-1:13 Number
| | | $[?(@.key==010)]
| | |            ^
| | o 1:12-1:13 SimpleValue
| | | $[?(@.key==010)]
| | |            ^
| | o 1:12-1:13 FilterValue
| | | $[?(@.key==010)]
| | |            ^
| | o 1:5-1:13 HigherPrecedenceFilterExpression
| | | $[?(@.key==010)]
| | |     ^^^^^^^^
| | | 
|/ /  
| | 
|/  
o 1:5-1:13 FilterExpression
| $[?(@.key==010)]
|     ^^^^^^^^
x 1:3-1:3 BracketElement
| $[?(@.key==010)]
|   ^
x 1:3-1:3 BracketElements
| $[?(@.key==010)]
|   ^
x 1:2-1:2 BracketChildren
| $[?(@.key==010)]
|  ^
x 1:2-1:2 Operator
| $[?(@.key==010)]
|  ^
o 1:1-1:2 Start
  $[?(@.key==010)]
  ^

Errors

Golang (github.com-spyzhov-ajson)

wrong request: wrong request: ?(@.key==010)

PHP (Goessner) ²

ArgumentCountError

Perl (JSON-Path)

non-safe evaluation, died at main.pl line 11.

Footnotes