Filter expression with not equals array or equals true
Setup
Selector: $[?((@.d!=["v1","v2"]) || (@.d == true))]
[
{"d": ["v1", "v2"] },
{"d": ["a", "b"] },
{"d" : true}
]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?((@.d!=["v1","v2"]) || (@.d == true))]': Invalid array index definition “?((@.d!=["v1","v2"]) || (@.d == true))]”
Clojure (json-path)
¹
[]
Cpp (jsoncons)
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
Dart (json_path)
Not supported
FormatException: end of input expected at 1:2. Expression: $[?((@.d!=["v1","v2"]) || (@.d == true))]
Elixir (ExJsonPath)
Not supported
illegal characters "|"
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Parser error: Invalid token on line 1, syntax error before: <<"[">>
Not supported
invalid syntax (position=1, reason=unrecognized input, near=[?((@.d!=["v1","v2"]) || (@.d == true))])
Not supported
parsing error: $[?((@.d!=["v1","v2"]) || (@.d == true))] :1:11 - 1:12 unexpected "[" while scanning extensions
Not supported
invalid filter term at position 10, following "!="
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?((@.d!=["v1","v2"]) || (@.d == true))]
Error: 1:11:
|
1 | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^^^^^
unexpected "["v1""
expecting "false", "null", "true", '!', '"', '$', ''', '@', digit, or white space
JavaScript (Goessner)
²
[
{
"d": [
"v1",
"v2"
]
},
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
JavaScript (brunerd)
[
{
"d": [
"v1",
"v2"
]
},
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
JavaScript (jsonpath)
[
{
"d": [
"v1",
"v2"
]
},
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
JavaScript (jsonpath-plus)
[
{
"d": [
"v1",
"v2"
]
},
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
Java (com.github.jsurfer)
Not supported
line 1:9 token recognition error at: '=['
line 1:4 no viable alternative at input '('
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.jayway.jsonpath)
¹
³
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
PHP (galbar-jsonpath)
²
[
{
"d": [
"v1",
"v2"
]
},
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
PHP (remorhaz-jsonpath)
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
Python (jsonpath)
²
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
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:23 token recognition error at: '|'
ValueError("line 1:23 token recognition error at: '|'")
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?((@.d!=["v1","v2"]) || (@.d == true))]
^^^^^^^^^^
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
dotNET (Json.NET)
Not supported
Unexpected character while parsing path query: (
dotNET (JsonCons.JsonPath)
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
dotNET (JsonPath.Net)
[
{
"d": [
"a",
"b"
]
},
{
"d": true
}
]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
Not supported
x 1:11-1:11 DocumentValue
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^
| x 1:11-1:11 IntegerPart
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| x 1:11-1:11 Number
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| x 1:11-1:11 SimpleValue
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| |
|/
x 1:11-1:11 FilterValue
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^
o 1:6-1:9 HigherPrecedenceFilterExpression
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^^^
x 1:6-1:6 LogicalOr
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^
| x 1:11-1:11 DocumentValue
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| | x 1:11-1:11 IntegerPart
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | x 1:11-1:11 Number
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | x 1:11-1:11 SimpleValue
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | |
| |/
| x 1:11-1:11 FilterValue
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| o 1:6-1:9 HigherPrecedenceFilterExpression
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^^^
| x 1:6-1:6 LogicalAnd
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| | x 1:11-1:11 DocumentValue
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | | x 1:11-1:11 IntegerPart
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | x 1:11-1:11 Number
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | x 1:11-1:11 SimpleValue
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | |
| | |/
| | x 1:11-1:11 FilterValue
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | o 1:6-1:9 HigherPrecedenceFilterExpression
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^^^
| | |
|/ /
| |
|/
o 1:6-1:9 FilterExpression
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^^^
x 1:5-1:5 UnaryFilterExpression
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^
x 1:5-1:5 HigherPrecedenceFilterExpression
| $[?((@.d!=["v1","v2"]) || (@.d == true))]
| ^
| x 1:11-1:11 DocumentValue
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| | x 1:11-1:11 IntegerPart
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | x 1:11-1:11 Number
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | x 1:11-1:11 SimpleValue
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | |
| |/
| x 1:11-1:11 FilterValue
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| o 1:6-1:9 HigherPrecedenceFilterExpression
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^^^
| x 1:6-1:6 LogicalOr
| | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | ^
| | x 1:11-1:11 DocumentValue
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | | x 1:11-1:11 IntegerPart
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | x 1:11-1:11 Number
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | x 1:11-1:11 SimpleValue
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | |
| | |/
| | x 1:11-1:11 FilterValue
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | o 1:6-1:9 HigherPrecedenceFilterExpression
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^^^
| | x 1:6-1:6 LogicalAnd
| | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | ^
| | | x 1:11-1:11 DocumentValue
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | | x 1:11-1:11 IntegerPart
| | | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | | ^
| | | | x 1:11-1:11 Number
| | | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | | ^
| | | | x 1:11-1:11 SimpleValue
| | | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | | ^
| | | | |
| | | |/
| | | x 1:11-1:11 FilterValue
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^
| | | o 1:6-1:9 HigherPrecedenceFilterExpression
| | | | $[?((@.d!=["v1","v2"]) || (@.d == true))]
| | | | ^^^
| | | |
| |/ /
| | |
| |/
Errors
Erlang (ejsonpath)
Timeout
unknown token at 6: ["v1","v2"])||(@.d==true) at 4
Exception: runtime error: comparing uncomparable type []interface {}
interface conversion: interface {} is nil, not string
wrong request: wrong request: ?((@.d!=["v1","v2"]) || (@.d == true))
PHP (Goessner)
²
ArgumentCountError
PHP (softcreatr-jsonpath)
Error: 'Malformed filter query'
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?((@.d!=["v1","v2"]) || (@.d == true))]
panic occurred
dotNET (JsonPathLib)
Object reference not set to an instance of an object.
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.