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
FormatException: end of input expected at 1:2. Expression: $[?(@.name=~/@.pattern/)]
Elixir (ExJsonPath)
Not supported
illegal characters "=~"
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Invalid syntax on line 1, {:illegal, '=~'}
Not found
member did not exist (path=[?(@.name=~/@.pattern/)])
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.*"
}
]
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)
²
Not found
jsonpath returned false, this might indicate an error
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: '~'")
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/)]
^^^^^^^^^^
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 (Manatee.Json)
Not supported
Unrecognized JSON Path Expression element. Path up to error: '$'
JSON (Path_Reference_Implementation)
Not supported
--> 1:3
|
1 | $[?(@.name=~/@.pattern/)]
| ^---
|
= expected unionChild, unionArrayIndex, or sliceStart
Proposal (A)
Not supported
x 1:11-1:11 ComparisonOperator
| $[?(@.name=~/@.pattern/)]
| ^
| x 1:11-1:11 ScalarOperator
| | $[?(@.name=~/@.pattern/)]
| | ^
| o 1:5-1:11 DocumentValue
| | $[?(@.name=~/@.pattern/)]
| | ^^^^^^
| o 1:5-1:11 UnaryFilterExpression
| | $[?(@.name=~/@.pattern/)]
| | ^^^^^^
| | x 1:11-1:11 ScalarOperator
| | | $[?(@.name=~/@.pattern/)]
| | | ^
| | o 1:5-1:11 DocumentValue
| | | $[?(@.name=~/@.pattern/)]
| | | ^^^^^^
| | o 1:5-1:11 FilterValue
| | | $[?(@.name=~/@.pattern/)]
| | | ^^^^^^
| | |
|/ /
| |
|/
o 1:5-1:11 HigherPrecedenceFilterExpression
| $[?(@.name=~/@.pattern/)]
| ^^^^^^
x 1:5-1:5 LogicalOr
| $[?(@.name=~/@.pattern/)]
| ^
| x 1:11-1:11 ComparisonOperator
| | $[?(@.name=~/@.pattern/)]
| | ^
| | x 1:11-1:11 ScalarOperator
| | | $[?(@.name=~/@.pattern/)]
| | | ^
| | o 1:5-1:11 DocumentValue
| | | $[?(@.name=~/@.pattern/)]
| | | ^^^^^^
| | o 1:5-1:11 UnaryFilterExpression
| | | $[?(@.name=~/@.pattern/)]
| | | ^^^^^^
| | | x 1:11-1:11 ScalarOperator
| | | | $[?(@.name=~/@.pattern/)]
| | | | ^
| | | o 1:5-1:11 DocumentValue
| | | | $[?(@.name=~/@.pattern/)]
| | | | ^^^^^^
| | | o 1:5-1:11 FilterValue
| | | | $[?(@.name=~/@.pattern/)]
| | | | ^^^^^^
| | | |
| |/ /
| | |
| |/
| o 1:5-1:11 HigherPrecedenceFilterExpression
| | $[?(@.name=~/@.pattern/)]
| | ^^^^^^
| x 1:5-1:5 LogicalAnd
| | $[?(@.name=~/@.pattern/)]
| | ^
| | x 1:11-1:11 ComparisonOperator
| | | $[?(@.name=~/@.pattern/)]
| | | ^
| | | x 1:11-1:11 ScalarOperator
| | | | $[?(@.name=~/@.pattern/)]
| | | | ^
| | | o 1:5-1:11 DocumentValue
| | | | $[?(@.name=~/@.pattern/)]
| | | | ^^^^^^
| | | o 1:5-1:11 UnaryFilterExpression
| | | | $[?(@.name=~/@.pattern/)]
| | | | ^^^^^^
| | | | x 1:11-1:11 ScalarOperator
| | | | | $[?(@.name=~/@.pattern/)]
| | | | | ^
| | | | o 1:5-1:11 DocumentValue
| | | | | $[?(@.name=~/@.pattern/)]
| | | | | ^^^^^^
| | | | o 1:5-1:11 FilterValue
| | | | | $[?(@.name=~/@.pattern/)]
| | | | | ^^^^^^
| | | | |
| | |/ /
| | | |
| | |/
| | o 1:5-1:11 HigherPrecedenceFilterExpression
| | | $[?(@.name=~/@.pattern/)]
| | | ^^^^^^
| | |
|/ /
| |
|/
o 1:5-1:11 FilterExpression
| $[?(@.name=~/@.pattern/)]
| ^^^^^^
x 1:3-1:3 BracketElement
| $[?(@.name=~/@.pattern/)]
| ^
x 1:3-1:3 BracketElements
| $[?(@.name=~/@.pattern/)]
| ^
x 1:2-1:2 BracketChildren
| $[?(@.name=~/@.pattern/)]
| ^
x 1:2-1:2 Operator
| $[?(@.name=~/@.pattern/)]
| ^
o 1:1-1:2 Start
$[?(@.name=~/@.pattern/)]
^
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
dotNET (JsonPathLib)
Object of type 'System.Double' cannot be converted to type 'Newtonsoft.Json.Linq.JToken'.
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.