Filter expression with dot notation with number
Setup
Selector: $[?(@.2 == 'second')]
[{"a": "first", "2": "second", "b": "third"}]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.2 == 'second')]': Invalid array index definition “?(@.2 == 'second')]”
Clojure (json-path)
¹
[]
Cpp (jsoncons)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Dart (json_path)
Not supported
end of input expected at 1:2
Elixir (ExJsonPath)
[]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Erlang (ejsonpath)
Not supported
syntax error before: 2
Not supported
parsing error: $[?(@.2 == 'second')] :1:6 - 1:8 unexpected Float while scanning parentheses expected ")"
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
[]
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Haskell (jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
JavaScript (brunerd)
Not supported
Java (com.github.jsurfer)
[]
Java (com.jayway.jsonpath)
¹
³
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
PHP (galbar-jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
PHP (remorhaz-jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
PHP (softcreatr-jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
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:6 mismatched input '2' expecting {'*', ID}
ValueError("line 1:6 mismatched input '2' expecting {'*', ID}")
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Rust (jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Rust (jsonpath_lib)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Rust (jsonpath_plus)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Scala (jsonpath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Swift (Sextant)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
dotNET (Json.NET)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
dotNET (JsonCons.JsonPath)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
dotNET (JsonPath.Net)
Not supported
Pattern '(@.2 == 's...' not recognized.
dotNET (Manatee.Json)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.2 == 'second')]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
[
{
"2": "second",
"a": "first",
"b": "third"
}
]
Errors
JavaScript (Goessner)
²
jsonPath: Unexpected number: _v.2 == 'second'
JavaScript (jsonpath)
Line 1: Unexpected number
JavaScript (jsonpath-plus)
Unexpected number
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
dotNET (JsonPathLib)
Line 1: Unexpected number
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.