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
Consensus
Not supported
Other responses
Bash (JSONPath.sh)
[]
Cpp (jsoncons)
[
{
"key": 42
}
]
Dart (json_path)
[
{
"key": 42
}
]
Elixir (jaxon)
[]
[
{
"key": 42
}
]
[
{
"key": 42
}
]
[]
Haskell (jsonpath)
[
{
"key": 42
}
]
JavaScript (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
JavaScript (jsonpath-plus)
[]
PHP (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
Perl (JSON-Path)
[]
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Python (python-jsonpath)
[
{
"key": 42
}
]
Rust (serde_json_path)
[
{
"key": 42
}
]
dotNET (JsonCons.JsonPath)
[
{
"key": 42
}
]
dotNET (JsonPath.Net)
[
{
"key": 42
}
]
dotNET (JsonPathLib)
[]
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.