Filter expression with boolean and operator and value true
Setup
Selector: $[?(@.key>0 && true)]
[
{"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 && true)]': Invalid array index definition “?(@.key>0 && true)]”
Clojure (json-path)
¹
[
{
"key": 1
},
{
"key": 3
}
]
Cpp (jsoncons)
[
{
"key": 1
},
{
"key": 3
}
]
Dart (json_path)
Not supported
ParserException[1:2]: end of input expected
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": ""
}
]
Erlang (ejsonpath)
Not supported
syntax error before: ')'
FSharp (FSharp.Data.JsonPath)
[]
Not supported
parsing error: $[?(@.key>0 && true)] :1:10 - 1:11 unexpected ">" while scanning parentheses expected ")"
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
[
{
"key": 1
},
{
"key": 3
}
]
[]
[
{
"key": 1
},
{
"key": 3
}
]
Not supported
jsonpath: invalid comparison operator at position 20
[
{
"key": 1
},
{
"key": 3
}
]
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.key>0 && true)]
Error: 1:20:
|
1 | $[?(@.key>0 && true)]
| ^^
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
}
]
JavaScript (swaggerexpert-jsonpath)
Not supported
Invalid JSONPath expression: "$[?(@.key>0 && true)]". Syntax error at position 19, expected "*", "0", "-", ":", "!", "(", "[", "_", ".", "==", "!=", "<=", ">=", "<", "@", "$", "e", "-0", ">", "||", ".."
Java (com.github.jsurfer)
Not supported
line 1:15 no viable alternative at input 'true'
org.antlr.v4.runtime.misc.ParseCancellationException
Java (com.github.xmljacquard.ajp)
Not supported
Error at char 18 in expression in xsl:sequence/@select on line 20 column 67 of ajp-runner.xslt:
<failed xmlns:ixml="http://invisiblexml.org/NS"
ixml:state="failed"><line>1</line><column>20</column><pos>20</pos><unexpected>)</unexpected><permitted>#9, #A, #D, ' ', '!', '<', '=', '>', '_', ['0'-'9'], ['a'-'z']</permitted><completions><completed rule="true" start="16" end="19"><input>true</input></completed><completed rule="literal" start="16" end="19"><input>true</input></completed><completed rule="comparable" start="16" end="19"><input>true</input></completed><completed rule="function-name" start="16" end="19"><input>true</input></completed><completed rule="comparison-expr" start="5" end="11"><input>@.key>0</input></completed><completed rule="basic-expr" start="5" end="11"><input>@.key>0</input></completed><completed rule="logical-and-expr" start="5" end="11"><input>@.key>0</input></completed><completed rule="logical-or-expr" start="5" end="11"><input>@.key>0</input></completed></completions><could-be-next><in rule="function-name-char"><tokens>'_'</tokens></in><in rule="comparison-op"><tokens>'!', '<', '=', '>'</tokens></in><in rule="DIGIT"><tokens>['0'-'9']</tokens></in><in rule="LCALPHA"><tokens>['a'-'z']</tokens></in><in rule="B"><tokens>#9, #A, #D, ' '</tokens></in></could-be-next><unfinished><open rule="comparison-expr" start="16" end="19"><input>true</input></open><open rule="paren-expr" start="4" end="11"><input>(@.key>0</input></open><open rule="filter-selector" start="3" end="3"><input>?</input></open><open rule="bracketed-selection" start="2" end="2"><input>[</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>
During lazy evaluation of tailCallLoop(ajp:getProcessor(...)) on line 20 of jar:file:./implementations/Java_com.github.xmljacquard.ajp/build/deps/org/xmljacquard/ajp/0.0.7/ajp-0.0.7.jar!/xslt/ajp-runner.xslt
In function ajpr:getProcessor on line 17 column 106 of ajp-runner.xslt:
net.sf.saxon.s9api.SaxonApiException: <failed xmlns:ixml="http://invisiblexml.org/NS" ixml:state="failed"><line>1</line><column>20</column><pos>20</pos><unexpected>)</unexpected><permitted>#9, #A, #D, ' ', '!', '<', '=', '>', '_', ['0'-'9'], ['a'-'z']</permitted><completions><completed rule="true" start="16" end="19"><input>true</input></completed><completed rule="literal" start="16" end="19"><input>true</input></completed><completed rule="comparable" start="16" end="19"><input>true</input></completed><completed rule="function-name" start="16" end="19"><input>true</input></completed><completed rule="comparison-expr" start="5" end="11"><input>@.key>0</input></completed><completed rule="basic-expr" start="5" end="11"><input>@.key>0</input></completed><completed rule="logical-and-expr" start="5" end="11"><input>@.key>0</input></completed><completed rule="logical-or-expr" start="5" end="11"><input>@.key>0</input></completed></completions><could-be-next><in rule="function-name-char"><tokens>'_'</tokens></in><in rule="comparison-op"><tokens>'!', '<', '=', '>'</tokens></in><in rule="DIGIT"><tokens>['0'-'9']</tokens></in><in rule="LCALPHA"><tokens>['a'-'z']</tokens></in><in rule="B"><tokens>#9, #A, #D, ' '</tokens></in></could-be-next><unfinished><open rule="comparison-expr" start="16" end="19"><input>true</input></open><open rule="paren-expr" start="4" end="11"><input>(@.key>0</input></open><open rule="filter-selector" start="3" end="3"><input>?</input></open><open rule="bracketed-selection" start="2" end="2"><input>[</input></open><open rule="jsonpath-query" start="1" end="1"><input>$</input></open></unfinished></failed>
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
}
]
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:12 token recognition error at: '&'
ValueError("line 1:12 token recognition error at: '&'")
Python (python-jsonpath)
Not supported
JSONPathSyntaxError('filter expression literals outside of function expressions must be compared')
Raku (JSON-Path)
Not supported
Evaluation of embedded Raku code not allowed (construct with :allow-eval)
Ruby (janeway-jsonpath)
[
{
"key": 1
},
{
"key": 3
}
]
Ruby (jsonpath)
[
{
"key": 1
},
{
"key": 3
}
]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?(@.key>0 && true)]
^^^^^^^^^^^^^^^^^^^
Rust (jsonpath_plus)
[
{
"key": 1
},
{
"key": 3
}
]
Rust (serde_json_path)
Not supported
at position 19, 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 (JsonPathLib)
[
{
"key": 1
},
{
"key": 3
},
{
"key": true
}
]
dotNET (Manatee.Json)
[
{
"key": 1
},
{
"key": 3
}
]
Errors
JavaScript (json-p3)
filter expression literals (true) must be compared (' && true)':15)
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
dotNET (Json.NET)
Input string was not in a correct format.
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.