Filter expression with regular expression from member
Setup
Selector: $[?(@.name=~/@.pattern/)]
[
{"name": "hullo world"},
{"name": "hello world"},
{"name": "yes hello world"},
{"name": "HELLO WORLD"},
{"name": "good bye"},
{"pattern": "hello.*"}
]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.name=~/@.pattern/)]': Invalid array index definition “?(@.name=~/@.pattern/)]”
Clojure (json-path)
¹
[
{
"pattern": "hello.*"
}
]
Cpp (jsoncons)
[]
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)
¹
Not supported
Invalid syntax on line 1, {:illegal, '=~'}
Not supported
parsing error: $[?(@.name=~/@.pattern/)] - 1:13 unknown operator =~
[]
Not supported
[]
[]
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.name=~/@.pattern/)]
Error: 1:11:
|
1 | $[?(@.name=~/@.pattern/)]
| ^
unexpected '='
expecting "!=", "&&", "<=", "==", ">=", "||", '!', ')', '.', '<', '>', '[', or white space
JavaScript (Goessner)
²
[
{
"name": -1
},
{
"name": -1
},
{
"name": -1
},
{
"name": -1
},
{
"name": -1
},
{
"name": -1,
"pattern": "hello.*"
}
]
JavaScript (brunerd)
[]
JavaScript (jsonpath)
[]
JavaScript (jsonpath-plus)
[
{
"name": -1
},
{
"name": -1
},
{
"name": -1
},
{
"name": -1
},
{
"name": -1
},
{
"name": -1,
"pattern": "hello.*"
}
]
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)
[]
PHP (remorhaz-jsonpath)
[]
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 token recognition error at: '~'
ValueError("line 1:11 token recognition error at: '~'")
Python (python-jsonpath)
[]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
Not supported
path error:
$[?(@.name=~/@.pattern/)]
^^^^^^^^^^
Rust (serde_json_path)
Not supported
at position 3, in long-hand segment, parser error
Scala (jsonpath)
Not supported
JPError(end of input expected)
Swift (Sextant)
[]
dotNET (Json.NET)
[]
dotNET (JsonCons.JsonPath)
[]
dotNET (JsonPath.Net)
Not supported
Pattern '(@.name=~/...' not recognized.
dotNET (JsonPathLib)
[
{
"name": -1.0
},
{
"name": -1.0
},
{
"name": -1.0
},
{
"name": -1.0
},
{
"name": -1.0
},
{
"name": -1.0,
"pattern": "hello.*"
}
]
dotNET (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
Errors
Erlang (ejsonpath)
Timeout
wrong request: wrong request: ?(@.name=~/@.pattern/)
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[?(@.name=~/@.pattern/)]
panic occurred
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.