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)
Not supported
Instance of 'ParserException': end of input expected (at 1:2)
Elixir (ExJsonPath)
[
{
"key": 10
}
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": 10
}
]
Erlang (ejsonpath)
[
{
"key": 10
}
]
[
{
"key": 10
}
]
[
{
"key": "010"
},
{
"key": "10"
},
{
"key": 10
}
]
[
{
"key": 10
}
]
[]
[
{
"key": 10
}
]
Haskell (jsonpath)
[
{
"key": 10
}
]
JavaScript (Goessner)
²
[
{
"key": 8
}
]
JavaScript (brunerd)
[
{
"key": 8
}
]
JavaScript (jsonpath)
[
{
"key": 8
}
]
JavaScript (jsonpath-plus)
[
{
"key": 8
}
]
JavaScript (jsonpathly)
[
{
"key": 10
}
]
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}")
Python (python-jsonpath)
[
{
"key": 10
}
]
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
}
]
Rust (serde_json_path)
Not supported
at position 3, in long-hand segment, parser error
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)
Not supported
Pattern '(@.key==01...' not recognized.
dotNET (JsonPathLib)
[
{
"key": 8
}
]
dotNET (Manatee.Json)
[
{
"key": 10
}
]
Errors
wrong request: wrong request: ?(@.key==010)
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
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.