Filter expression without parens
Setup
Selector: $[?@.key==42]
[
{"key": 0},
{"key": 42},
{"key": -1},
{"key": 1},
{"key": 41},
{"key": 43},
{"key": 42.0001},
{"key": 41.9999},
{"key": 100},
{"key": "some"},
{"key": "42"},
{"key": null},
{"key": 420},
{"key": ""},
{"key": {}},
{"key": []},
{"key": [42]},
{"key": {"key": 42}},
{"key": {"some": 42}},
{"some": "value"}
]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?@.key==42]': Invalid array index definition “?@.key==42]”
Cpp (jsoncons)
[
{
"key": 42
}
]
Dart (json_path)
[
{
"key": 42
}
]
Elixir (ExJsonPath)
Not supported
syntax error before: '@'
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Parser error: Invalid token on line 1, syntax error before: <<"@">>
Erlang (ejsonpath)
Not supported
syntax error before: '@'
[
{
"key": 42
}
]
[
{
"key": 42
}
]
[]
[
{
"key": 42
}
]
Not supported
invalid array index [?@.key==42] before position 13: non-integer array index
Haskell (jsonpath)
[
{
"key": 42
}
]
JavaScript (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
JavaScript (brunerd)
Not supported
JavaScript (json-p3)
[
{
"key": 42
}
]
JavaScript (jsonpath)
Not supported
Lexical error on line 1. Unrecognized text.
$[?@.key==42]
--^
JavaScript (jsonpath-plus)
[]
JavaScript (jsonpathly)
Not supported
missing '(' at '@'
Java (com.github.jsurfer)
Not supported
line 1:2 token recognition error at: '?'
line 1:3 no viable alternative at input '[@'
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.jayway.jsonpath)
¹
³
Not supported
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
com.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 1. Expected ?, ', 0-9, *
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
Not supported
Could not parse token starting at position 1 . Expected ?, ', 0-9, *
PHP (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
PHP (galbar-jsonpath)
Not supported
Invalid JSONPath error: 'Error in JSONPath near '?@.key==42''
PHP (remorhaz-jsonpath)
Not supported
Error: 'Failed to build AST from JSONPath query: $[?@.key==42]'
PHP (softcreatr-jsonpath)
Not supported
Error: 'Unable to parse token ?@.key==42 in expression: [?@.key==42]'
Perl (JSON-Path)
[]
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:3 missing '(' at '@'
ValueError("line 1:3 missing '(' at '@'")
Python (python-jsonpath)
[
{
"key": 42
}
]
Raku (JSON-Path)
Not supported
JSON path parse error at position 1
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?@.key==42]
^^^^
Rust (serde_json_path)
[
{
"key": 42
}
]
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
Not supported
NOT_SUPPORTED
dotNET (Json.NET)
Not supported
Unexpected character while parsing path indexer: @
dotNET (JsonCons.JsonPath)
[
{
"key": 42
}
]
dotNET (JsonPath.Net)
[
{
"key": 42
}
]
dotNET (JsonPathLib)
[]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path element. Path up to error: '$'
Errors
Clojure (json-path)
¹
java.lang.NumberFormatException For input string: "@"
path: invalid character at 4
interface conversion: interface {} is nil, not string
Ruby (jsonpath)
invalid value for Integer(): "@.key==42"
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?@.key==42]
panic occurred
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.