Filter expression with boolean or operator and value false
Setup
Selector: $[?(@.key>0 || false)]
[
{"key": 1},
{"key": 3},
{"key": "nice"},
{"key": true},
{"key": null},
{"key": false},
{"key": {}},
{"key": []},
{"key": -1},
{"key": 0},
{"key": ""}
]
Results
Other responses
Bash (JSONPath.sh)
[
1,
3,
true,
null,
false
]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.key>0 || false)]': Invalid array index definition “?(@.key>0 || false)]”
Clojure (json-path)
¹
[
{
"key": 1
},
{
"key": 3
}
]
Cpp (jsoncons)
[
{
"key": 1
},
{
"key": 3
}
]
Dart (json_path)
Not supported
Instance of 'ParserException': end of input expected (at 1:2)
Elixir (ExJsonPath)
Not supported
illegal characters "|"
Elixir (jaxon)
[]
Elixir (warpath)
¹
[
{
"key": 1
},
{
"key": 3
},
{
"key": "nice"
},
{
"key": true
},
{
"key": null
},
{
"key": false
},
{
"key": {}
},
{
"key": []
},
{
"key": ""
}
]
Not supported
parsing error: $[?(@.key>0 || false)] :1:10 - 1:11 unexpected ">" while scanning parentheses expected ")"
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
[
{
"key": 1
},
{
"key": 3
}
]
[]
[
{
"key": 1
},
{
"key": 3
}
]
[
{
"key": 1
},
{
"key": 3
}
]
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.key>0 || false)]
Error: 1:21:
|
1 | $[?(@.key>0 || false)]
| ^^
unexpected ")]"
expecting "!=", "<=", "==", ">=", '!', '<', '>', or white space
JavaScript (Goessner)
²
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
JavaScript (brunerd)
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
JavaScript (jsonpath)
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
JavaScript (jsonpath-plus)
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
JavaScript (jsonpathly)
[
{
"key": 1
},
{
"key": 3
}
]
Java (com.github.jsurfer)
Not supported
line 1:15 no viable alternative at input 'false'
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.jayway.jsonpath)
¹
³
Not supported
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
com.jayway.jsonpath.InvalidPathException: Expected path node
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
Not supported
Expected character ')' but found '|'
PHP (galbar-jsonpath)
[
{
"key": 1
},
{
"key": 3
},
{
"key": "nice"
},
{
"key": []
},
{
"key": []
}
]
PHP (remorhaz-jsonpath)
[
{
"key": 1
},
{
"key": 3
}
]
PHP (softcreatr-jsonpath)
[
{
"key": 1
},
{
"key": 3
},
{
"key": "nice"
},
{
"key": {}
},
{
"key": []
}
]
Python (jsonpath)
²
[
{
"key": 1
},
{
"key": 3
},
{
"key": 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:12 token recognition error at: '|'
ValueError("line 1:12 token recognition error at: '|'")
Python (python-jsonpath)
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
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>0 || false)]
^^^^^^^^^^^^^^^^^^^^
Rust (jsonpath_plus)
[
{
"key": 1
},
{
"key": 3
}
]
Rust (serde_json_path)
Not supported
at position 20, in long-hand segment, parser error
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
Not supported
NOT_SUPPORTED
dotNET (JsonCons.JsonPath)
[
{
"key": 1
},
{
"key": 3
}
]
dotNET (JsonPath.Net)
Not supported
Pattern '(@.key>0 |...' not recognized.
dotNET (Manatee.Json)
[
{
"key": 1
},
{
"key": 3
}
]
Errors
Erlang (ejsonpath)
Timeout
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Ruby (jsonpath)
comparison of String with 0.0 failed
dotNET (Json.NET)
Input string was not in a correct format.
dotNET (JsonPathLib)
Accessed JArray values with invalid key value: "valueOf". Int32 array index expected.
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.