Filter expression with local dot key and null in data
Setup
Selector: $[?(@.key='value')]
[
{"key": 0},
{"key": "value"},
null,
{"key": 42},
{"some": "value"}
]
Results
Consensus
Not supported
Other responses
Bash (JSONPath.sh)
[]
Clojure (json-path)
¹
[
null,
{
"some": "value"
}
]
Elixir (jaxon)
[]
[]
JavaScript (Goessner)
²
[
{
"key": "value"
},
{
"key": "value"
},
{
"key": "value"
},
{
"key": "value",
"some": "value"
}
]
JavaScript (jsonpath)
[]
PHP (softcreatr-jsonpath)
[
{
"key": "value"
}
]
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Errors
Erlang (ejsonpath)
Timeout
unknown token at 5: ='value' at 4
wrong symbol '=' at 7
JavaScript (jsonpath-plus)
jsonPath: Cannot set property 'key' of null: @.key='value'
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Ruby (jsonpath)
undefined method `=' for 0.0:Float
Did you mean? =~
==
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?(@.key='value')]
panic occurred
dotNET (JsonPathLib)
Object of type 'System.String' cannot be converted to type 'Newtonsoft.Json.Linq.JToken'.
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.