Filter expression with length free function
Setup
Selector: $[?(length(@) == 4)]
[
[1,2,3,4,5],
[1,2,3,4],
[1,2,3]
]
Results
Consensus
Not supported
Other responses
Bash (JSONPath.sh)
[]
Clojure (json-path)
¹
[]
Cpp (jsoncons)
[
[
1,
2,
3,
4
]
]
Elixir (jaxon)
[]
[]
[]
[]
[
[
1,
2,
3,
4
]
]
JavaScript (jsonpath)
[]
PHP (galbar-jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Ruby (jsonpath)
[
[
1,
2,
3,
4,
5
],
[
1,
2,
3,
4
],
[
1,
2,
3
]
]
dotNET (JsonCons.JsonPath)
[
[
1,
2,
3,
4
]
]
dotNET (JsonPath.Net)
[
[
1,
2,
3,
4
]
]
Errors
JavaScript (Goessner)
²
jsonPath: length is not defined: length(_v) == 4
JavaScript (brunerd)
Invocation violation: (length(@)
JavaScript (jsonpath-plus)
jsonPath: length is not defined: length(@) == 4
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:
$[?(length(@) == 4)]
panic occurred
dotNET (JsonPathLib)
length is not defined
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.