Filter expression with subfilter
Setup
Selector: $[?(@.a[?(@.price>10)])]
[
{
"a": [{"price": 1}, {"price": 3}]
},
{
"a": [{"price": 11}]
},
{
"a": [{"price": 8}, {"price": 12}, {"price": 3}]
},
{
"a": []
}
]
Results
Other responses
Bash (JSONPath.sh)
[]
C (json-glib)
Not supported
Unable to compile selector `$[?(@.a[?(@.price>10)])]': Invalid array index definition “?(@.a[?(@.price>10)])]”
Clojure (json-path)
¹
[]
Cpp (jsoncons)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Dart (json_path)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Elixir (ExJsonPath)
Not supported
syntax error before: ')'
Elixir (jaxon)
[]
Elixir (warpath)
¹
Not supported
Parser error: Invalid token on line 1, syntax error before: <<"?">>
Erlang (ejsonpath)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Not supported
parsing error: $[?(@.a[?(@.price>10)])] :1:18 - 1:19 unexpected ">" while scanning parentheses expected ")"
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
[]
[]
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Haskell (jsonpath)
Not supported
Invalid JSONPath: $[?(@.a[?(@.price>10)])]
Error: 1:9:
|
1 | $[?(@.a[?(@.price>10)])]
| ^
unexpected '?'
expecting '!', '"', ''', '+', '-', integer, or white space
JavaScript (brunerd)
Not supported
JavaScript (jsonpath)
Not supported
Lexical error on line 1. Unrecognized text.
...?(@.a[?(@.price>10)])]
-----------------------^
JavaScript (jsonpath-plus)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
JavaScript (jsonpathly)
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
Java (com.jayway.jsonpath)
¹
³
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
Kotlin (com.nfeld.jsonpathkt)
¹
Not supported
Unexpected char, char=?, index=2
Objective-C (SMJJSONPath)
¹
³
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
PHP (galbar-jsonpath)
Not supported
Invalid JSONPath error: 'Error in JSONPath near '[?(@.price''
PHP (remorhaz-jsonpath)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
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)
[]
Python (python-jsonpath)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Raku (JSON-Path)
Not supported
Evaluation of embedded Perl 6 code not allowed (construct with :allow-eval)
Ruby (jsonpath)
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
Rust (jsonpath)
Not supported
parsing error
Rust (jsonpath_lib)
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
Rust (jsonpath_plus)
[]
Rust (serde_json_path)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Scala (jsonpath)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
Swift (Sextant)
[
{
"a": [
{
"price": 1
},
{
"price": 3
}
]
},
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
},
{
"a": []
}
]
dotNET (Json.NET)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
dotNET (JsonCons.JsonPath)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
dotNET (JsonPath.Net)
[
{
"a": [
{
"price": 11
}
]
},
{
"a": [
{
"price": 8
},
{
"price": 12
},
{
"price": 3
}
]
}
]
dotNET (Manatee.Json)
Not supported
JSON Path expression indexers only support single constant values. Path up to error: '$'
Errors
JavaScript (Goessner)
²
jsonPath: Unexpected token ?: _v.a[?(_v.price>10)
Java (com.github.jsurfer)
java.lang.NullPointerException: Cannot invoke "org.jsfr.json.path.JsonPath$Builder.build()" because "this.filterPathBuilder" is null
PHP (Goessner)
²
ArgumentCountError
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
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.