Filter expression with length free function

Setup

Selector: $[?(length(@) == 4)]

[
  [1,2,3,4,5],
  [1,2,3,4],
  [1,2,3]
]

Results

Other responses

Bash (JSONPath.sh)

[]

C (json-glib)

Not supported

Unable to compile selector `$[?(length(@) == 4)]': Invalid array index definition “?(length(@) == 4)]”

Clojure (json-path) ¹

[]

Cpp (jsoncons)

[
  [
    1,
    2,
    3,
    4
  ]
]

Dart (json_path)

[
  [
    1,
    2,
    3,
    4
  ]
]

Elixir (ExJsonPath)

Not supported

syntax error before: <<"length">>

Elixir (jaxon)

[]

Elixir (warpath) ¹

Not supported

Parser error: Invalid token on line 1, forbidden function 'length', it's only allowed to call whitelist functions: [is_atom, is_binary, is_boolean, is_float, is_integer, is_list, is_map, is_nil, is_number, is_tuple]

Erlang (ejsonpath)

Not supported

syntax error before: '@'

Golang (github.com-PaesslerAG-jsonpath) ¹

[]

Golang (github.com-bhmj-jsonslice) ¹ ³

[]

Golang (github.com-ohler55-ojg)

[
  [
    1,
    2,
    3,
    4
  ]
]

Golang (github.com-oliveagle-jsonpath) ¹

[]

Golang (github.com-spyzhov-ajson)

[
  [
    1,
    2,
    3,
    4
  ]
]

Golang (github.com-vmware-labs-yaml-jsonpath)

Not supported

invalid filter syntax at position 4, following "[?("

Haskell (jsonpath)

Not supported

Invalid JSONPath: $[?(length(@) == 4)]
 Error: 1:5:
  |
1 | $[?(length(@) == 4)]
  |     ^^^^^
unexpected "lengt"
expecting "false", "null", "true", '!', '"', '$', ''', '(', '@', digit, or white space

JavaScript (jsonpath)

[]

JavaScript (jsonpathly)

Not supported

extraneous input 'length' expecting {'@', '$', '!', 'true', 'false', 'null', '{', '[', '(', NUMBER, STRING}

Java (com.github.jsurfer)

Not supported

line 1:4 no viable alternative at input 'length'
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: Failed to parse filter: [?(length(@) == 4)], error on position: 3, char: l

Kotlin (com.nfeld.jsonpathkt) ¹

Not supported

Unexpected char, char=?, index=2

Objective-C (SMJJSONPath) ¹ ³

Not supported

path node expected

PHP (galbar-jsonpath)

[]

PHP (remorhaz-jsonpath)

Not supported

Error: 'Failed to build AST from JSONPath query: $[?(length(@) == 4)]'

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:4 extraneous input 'length' expecting {'@', '$', 'not', 'true', 'false', 'null', '{', '[', '(', STRING, NUMBER}
ValueError("line 1:4 extraneous input 'length' expecting {'@', '$', 'not', 'true', 'false', 'null', '{', '[', '(', STRING, NUMBER}")

Python (python-jsonpath)

[
  [
    1,
    2,
    3,
    4
  ]
]

Raku (JSON-Path)

Not supported

Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)

Ruby (jsonpath)

[
  [
    1,
    2,
    3,
    4,
    5
  ],
  [
    1,
    2,
    3,
    4
  ],
  [
    1,
    2,
    3
  ]
]

Rust (jsonpath)

Not supported

parsing error

Rust (jsonpath_lib)

Not supported

path error: 
$[?(length(@) == 4)]
^^^^^^^^^^

Rust (serde_json_path)

[
  [
    1,
    2,
    3,
    4
  ]
]

Scala (jsonpath)

Not supported

JPError(end of input expected)

Swift (Sextant)

Not supported

NOT_SUPPORTED

dotNET (Json.NET)

Not supported

Unexpected character while parsing path query: l

dotNET (JsonCons.JsonPath)

[
  [
    1,
    2,
    3,
    4
  ]
]

dotNET (JsonPath.Net)

[
  [
    1,
    2,
    3,
    4
  ]
]

dotNET (Manatee.Json)

Not supported

Unrecognized JSON Path Expression element. Path up to error: '$'

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