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
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.key===42)]': Invalid array index definition “?(@.key===42)]”
Clojure (json-path)
¹
[
{
"key": null
},
{
"some": "value"
}
]
Cpp (jsoncons)
Not supported
JSON syntax_error at line 1 and column 15
Dart (json_path)
Not supported
Instance of 'ParserException': end of input expected (at 1:2)
Elixir (ExJsonPath)
Not supported
illegal characters "=4"
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": 42
}
]
Not supported
parsing error: $[?(@.key===42)] :1:12 - 1:13 unexpected "=" while scanning extensions
[
{
"key": 42
}
]
Not supported
[]
Not supported
invalid filter term at position 11, following "=="
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.key===42)]
Error: 1:12:
|
1 | $[?(@.key===42)]
| ^^^^^
unexpected "=42)]"
expecting "false", "null", "true", '!', '"', '$', ''', '@', digit, or white space
JavaScript (Goessner)
²
[
{
"key": 42
}
]
JavaScript (brunerd)
[
{
"key": 42
}
]
JavaScript (jsonpath)
[
{
"key": 42
}
]
JavaScript (jsonpath-plus)
[
{
"key": 42
}
]
JavaScript (jsonpathly)
Not supported
mismatched input '' expecting {'@', '$', 'true', 'false', 'null', '{', '[', '(', NUMBER, STRING}
Java (com.jayway.jsonpath)
¹
³
[
{
"key": 42
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"key": 42
}
]
PHP (galbar-jsonpath)
Not supported
Invalid JSONPath error: 'Error in JSONPath near '=''
PHP (remorhaz-jsonpath)
Not supported
Error: 'Failed to build AST from JSONPath query: $[?(@.key===42)]'
PHP (softcreatr-jsonpath)
[]
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:10 mismatched input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:10 mismatched input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")
Python (python-jsonpath)
Not supported
JSONPathSyntaxError("unexpected token '='")
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?(@.key===42)]
^^^^^^^^^^^
Rust (serde_json_path)
Not supported
at position 3, in long-hand segment, parser error
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
[
{
"key": 42
}
]
dotNET (Json.NET)
[
{
"key": 42
}
]
dotNET (JsonCons.JsonPath)
Not supported
Expected function
dotNET (JsonPath.Net)
Not supported
Pattern '(@.key===4...' not recognized.
dotNET (JsonPathLib)
[
{
"key": 42
}
]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
Errors
Erlang (ejsonpath)
Timeout
wrong symbol '=' at 9
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.
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.