Filter expression with triple 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)
[]
Clojure (json-path)
¹
[
{
"key": null
},
{
"some": "value"
}
]
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": 42
}
]
FSharp (FSharp.Data.JsonPath)
[]
[
{
"key": 42
}
]
[]
JavaScript (Goessner)
²
[
{
"key": 42
}
]
JavaScript (brunerd)
[
{
"key": 42
}
]
JavaScript (jsonpath)
[
{
"key": 42
}
]
JavaScript (jsonpath-plus)
[
{
"key": 42
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"key": 42
}
]
Objective-C (SMJJSONPath)
¹
³
[
{
"key": 42
}
]
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Ruby (jsonpath)
[]
Swift (Sextant)
[
{
"key": 42
}
]
dotNET (Json.NET)
[
{
"key": 42
}
]
dotNET (JsonPathLib)
[
{
"key": 42
}
]
Errors
Erlang (ejsonpath)
Timeout
wrong symbol '=' at 9
JavaScript (json-p3)
unexpected filter selector token '=' ('ey===42)]':11)
JavaScript (jsonpathly)
Expected "$", "(", "@", "[", "count", "false", "length", "match", "null", "search", "true", "value", "{", number, or string but "=" found.
Java (com.github.jsurfer)
line 1:11 token recognition error at: '=4'
java.lang.NumberFormatException: Character " is neither a decimal digit number, decimal point, nor "e" notation exponential mark.
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
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.