Filter expression with single equal
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)
[
42,
"42"
]
Clojure (json-path)
¹
[
{
"key": 42
}
]
Elixir (jaxon)
[]
[]
JavaScript (Goessner)
²
[
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42,
"some": "value"
}
]
JavaScript (jsonpath)
[]
JavaScript (jsonpath-plus)
[
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42
},
{
"key": 42,
"some": "value"
}
]
PHP (softcreatr-jsonpath)
[
{
"key": 42
},
{
"key": "42"
}
]
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Python (jsonpath2)
[]
dotNET (JsonPathLib)
[
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0
},
{
"key": 42.0,
"some": "value"
}
]
Errors
Erlang (ejsonpath)
Timeout
unknown token at 5: =42 at 4
wrong symbol '=' at 7
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=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.