Filter expression with in array of values
Setup
Selector: $[?(@.d in [2, 3])]
[{"d": 1}, {"d": 2}, {"d": 1}, {"d": 3}, {"d": 4}]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.d in [2, 3])]': Invalid array index definition “?(@.d in [2, 3])]”
Cpp (jsoncons)
Not supported
Expected dot or left bracket separator at line 1 and column 9
Dart (json_path)
Not supported
end of input expected at 1:2
Elixir (ExJsonPath)
Not supported
syntax error before: <<"in">>
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"d": 2
},
{
"d": 3
}
]
Erlang (ejsonpath)
Not supported
syntax error before: <<"in">>
Not supported
parsing error: $[?(@.d in [2, 3])] :1:9 - 1:11 unexpected Ident while scanning parentheses expected ")"
[]
[
{
"d": 2
},
{
"d": 3
}
]
Not supported
invalid filter expression at position 8, following ".d "
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.d in [2, 3])]
Error: 1:9:
|
1 | $[?(@.d in [2, 3])]
| ^^
unexpected "in"
expecting "!=", "&&", "<=", "==", ">=", "||", '!', ')', '<', '>', or white space
JavaScript (Goessner)
²
[
{
"d": 1
},
{
"d": 1
}
]
JavaScript (brunerd)
[
{
"d": 1
},
{
"d": 2
},
{
"d": 1
},
{
"d": 3
},
{
"d": 4
}
]
JavaScript (jsonpath)
[]
JavaScript (jsonpath-plus)
[
{
"d": 1
},
{
"d": 1
}
]
Java (com.github.jsurfer)
Not supported
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.jayway.jsonpath)
¹
³
[
{
"d": 2
},
{
"d": 3
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"d": 2
},
{
"d": 3
}
]
PHP (galbar-jsonpath)
[
{
"d": 2
},
{
"d": 3
}
]
PHP (remorhaz-jsonpath)
Not supported
Error: 'Failed to build AST from JSONPath query: $[?(@.d in [2, 3])]'
PHP (softcreatr-jsonpath)
[
{
"d": 2
},
{
"d": 3
}
]
Python (jsonpath)
²
[
{
"d": 2
},
{
"d": 3
}
]
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:8 mismatched input 'in' expecting ')'
ValueError("line 1:8 mismatched input 'in' expecting ')'")
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:
$[?(@.d in [2, 3])]
^^^^^^^^^^
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
[
{
"d": 2
},
{
"d": 3
}
]
dotNET (Json.NET)
Not supported
Could not read query operator.
dotNET (JsonCons.JsonPath)
Not supported
Syntax error
dotNET (JsonPath.Net)
[
{
"d": 2
},
{
"d": 3
}
]
dotNET (JsonPathLib)
[
{
"d": 1
},
{
"d": 1
}
]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.d in [2, 3])]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
Not supported
x 1:9-1:9 ComparisonOperator
| $[?(@.d in [2, 3])]
| ^
o 1:5-1:8 HigherPrecedenceFilterExpression
| $[?(@.d in [2, 3])]
| ^^^
x 1:5-1:5 LogicalOr
| $[?(@.d in [2, 3])]
| ^
| x 1:9-1:9 ComparisonOperator
| | $[?(@.d in [2, 3])]
| | ^
| o 1:5-1:8 HigherPrecedenceFilterExpression
| | $[?(@.d in [2, 3])]
| | ^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.d in [2, 3])]
| | ^
| | x 1:9-1:9 ComparisonOperator
| | | $[?(@.d in [2, 3])]
| | | ^
| | o 1:5-1:8 HigherPrecedenceFilterExpression
| | | $[?(@.d in [2, 3])]
| | | ^^^
| | |
|/ /
| |
|/
o 1:5-1:8 FilterExpression
| $[?(@.d in [2, 3])]
| ^^^
x 1:3-1:3 BracketElement
| $[?(@.d in [2, 3])]
| ^
x 1:3-1:3 BracketElements
| $[?(@.d in [2, 3])]
| ^
x 1:2-1:2 BracketChildren
| $[?(@.d in [2, 3])]
| ^
x 1:2-1:2 Operator
| $[?(@.d in [2, 3])]
| ^
o 1:1-1:2 Start
$[?(@.d in [2, 3])]
^
Errors
Clojure (json-path)
¹
java.lang.Exception object must be an array.
interface conversion: interface {} is nil, not string
wrong request: wrong request: ?(@.d in [2, 3])
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Ruby (jsonpath)
invalid value for Integer(): " 3])"
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?(@.d in [2, 3])]
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.