Filter expression with equals number for array slice with range 1
Setup
Selector: $[?(@[0:1]==1)]
[[1, 2, 3], [1], [2, 3], 1, 2]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@[0:1]==1)]': Invalid array index definition “?(@[0:1]==1)]”
Cpp (jsoncons)
[]
Dart (json_path)
Not supported
Instance of 'ParserException': end of input expected (at 1:2)
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Parser error: Invalid token on line 1, syntax error before: <<":">>
[]
[]
[
[
1,
2,
3
],
[
1
]
]
[
[
1,
2,
3
],
[
1
]
]
[
[
1,
2,
3
],
[
1
]
]
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@[0:1]==1)]
Error: 1:8:
|
1 | $[?(@[0:1]==1)]
| ^
unexpected ':'
expecting '!', ']', digit, or white space
JavaScript (brunerd)
Not supported
JavaScript (jsonpathly)
[]
Java (com.github.jsurfer)
[]
Java (com.jayway.jsonpath)
¹
³
[]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[]
PHP (galbar-jsonpath)
[
[
1,
2,
3
],
[
1
]
]
PHP (remorhaz-jsonpath)
[
[
1,
2,
3
],
[
1
]
]
PHP (softcreatr-jsonpath)
[]
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:11 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}
ValueError("line 1:11 extraneous input '=' expecting {'@', '$', 'true', 'false', 'null', '{', '[', STRING, NUMBER}")
Python (python-jsonpath)
[
[
1,
2,
3
],
[
1
]
]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[
[
1,
2,
3
],
[
1
],
[
2,
3
],
1,
2
]
Rust (jsonpath)
[]
Rust (jsonpath_plus)
[
[
1,
2,
3
],
[
1
]
]
Rust (serde_json_path)
Not supported
at position 3, in long-hand segment, parser error
Scala (jsonpath)
[
[
1,
2,
3
],
[
1
]
]
Swift (Sextant)
[]
dotNET (Json.NET)
[
[
1,
2,
3
],
[
1
]
]
dotNET (JsonCons.JsonPath)
[]
dotNET (JsonPath.Net)
Not supported
Pattern '(@[0:1]==1...' not recognized.
dotNET (Manatee.Json)
Not supported
JSON Path expression indexers only support single constant values. Path up to error: '$'
Errors
Clojure (json-path)
¹
java.lang.Exception object must be an array.
Elixir (ExJsonPath)
Protocol.UndefinedError
Erlang (ejsonpath)
init terminating in do_boot (not_implemented)
Crash dump is being written to: /dev/null...done
{"init terminating in do_boot",not_implemented}
interface conversion: interface {} is nil, not string
JavaScript (Goessner)
²
jsonPath: Unexpected token :: _v[0:1]==1
JavaScript (jsonpath)
Line 1: Unexpected token :
JavaScript (jsonpath-plus)
Unexpected token ':'
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Rust (jsonpath_lib)
panic occurred
dotNET (JsonPathLib)
Line 1: Unexpected token :
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.