Filter expression with value after dot notation with wildcard on array of objects
Setup
Selector: $.*[?(@.key)]
[
{
"some": "some value"
},
{
"key": "value"
}
]
Results
Consensus
[]
Not found consensus
This consensus applies for implementations which return a specific not found value if no match exists.
NOT_FOUND
Other responses
C (json-glib)
Not supported
Unable to compile selector `$.*[?(@.key)]': Invalid array index definition “?(@.key)]”
Elixir (ExJsonPath)
Not supported
syntax error before: ')'
Elixir (warpath)
¹
[
{
"key": "value"
}
]
[
{
"key": "value"
}
]
JavaScript (Goessner)
²
[
"value"
]
JavaScript (brunerd)
[
"value"
]
JavaScript (jsonpathly)
[
{
"key": "value"
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"key": "value"
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=4
Objective-C (SMJJSONPath)
¹
³
[
{
"key": "value"
}
]
PHP (remorhaz-jsonpath)
[
{
"key": "value"
}
]
Python (jsonpath-ng)
Not supported
JsonPathLexerError('Error on line 1, col 4: Unexpected character: ? ')
Python (jsonpath-rw)
Not supported
JsonPathLexerError('Error on line 1, col 4: Unexpected character: ? ')
Python (jsonpath2)
[
{
"key": "value"
}
]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[
{
"key": "value"
},
{
"key": "value"
}
]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
[
{
"key": "value"
}
]
Swift (Sextant)
[
{
"key": "value"
}
]
Errors
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
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.