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
FormatException: end of input expected at 1:2. Expression: $[?(@.key===42)]
Elixir (ExJsonPath)
Not supported
illegal characters "=4"
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": 42
}
]
Not supported
invalid syntax (position=1, reason=unrecognized input, near=[?(@.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
}
]
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}")
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)]
^^^^^^^^^^^
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)
[]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.key===42)]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
Not supported
x 1:12-1:12 DocumentValue
| $[?(@.key===42)]
| ^
| x 1:12-1:12 IntegerPart
| | $[?(@.key===42)]
| | ^
| x 1:12-1:12 Number
| | $[?(@.key===42)]
| | ^
| x 1:12-1:12 SimpleValue
| | $[?(@.key===42)]
| | ^
| |
|/
x 1:12-1:12 FilterValue
| $[?(@.key===42)]
| ^
o 1:5-1:10 HigherPrecedenceFilterExpression
| $[?(@.key===42)]
| ^^^^^
x 1:5-1:5 LogicalOr
| $[?(@.key===42)]
| ^
| x 1:12-1:12 DocumentValue
| | $[?(@.key===42)]
| | ^
| | x 1:12-1:12 IntegerPart
| | | $[?(@.key===42)]
| | | ^
| | x 1:12-1:12 Number
| | | $[?(@.key===42)]
| | | ^
| | x 1:12-1:12 SimpleValue
| | | $[?(@.key===42)]
| | | ^
| | |
| |/
| x 1:12-1:12 FilterValue
| | $[?(@.key===42)]
| | ^
| o 1:5-1:10 HigherPrecedenceFilterExpression
| | $[?(@.key===42)]
| | ^^^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.key===42)]
| | ^
| | x 1:12-1:12 DocumentValue
| | | $[?(@.key===42)]
| | | ^
| | | x 1:12-1:12 IntegerPart
| | | | $[?(@.key===42)]
| | | | ^
| | | x 1:12-1:12 Number
| | | | $[?(@.key===42)]
| | | | ^
| | | x 1:12-1:12 SimpleValue
| | | | $[?(@.key===42)]
| | | | ^
| | | |
| | |/
| | x 1:12-1:12 FilterValue
| | | $[?(@.key===42)]
| | | ^
| | o 1:5-1:10 HigherPrecedenceFilterExpression
| | | $[?(@.key===42)]
| | | ^^^^^
| | |
|/ /
| |
|/
o 1:5-1:10 FilterExpression
| $[?(@.key===42)]
| ^^^^^
x 1:3-1:3 BracketElement
| $[?(@.key===42)]
| ^
x 1:3-1:3 BracketElements
| $[?(@.key===42)]
| ^
x 1:2-1:2 BracketChildren
| $[?(@.key===42)]
| ^
x 1:2-1:2 Operator
| $[?(@.key===42)]
| ^
o 1:1-1:2 Start
$[?(@.key===42)]
^
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.