Filter expression with parent axis operator
Setup
Selector: $[*].bookmarks[?(@.page == 45)]^^^
[
{
"title": "Sayings of the Century",
"bookmarks": [{
"page": 40
}]
},
{
"title": "Sword of Honour",
"bookmarks": [
{
"page": 35
},
{
"page": 45
}
]
},
{
"title": "Moby Dick",
"bookmarks": [
{
"page": 3035
},
{
"page": 45
}
]
}
]
Results
Consensus
Not supported
Other responses
Bash (JSONPath.sh)
[]
Clojure (json-path)
¹
[]
Cpp (jsoncons)
[
[
{
"bookmarks": [
{
"page": 40
}
],
"title": "Sayings of the Century"
},
{
"bookmarks": [
{
"page": 35
},
{
"page": 45
}
],
"title": "Sword of Honour"
},
{
"bookmarks": [
{
"page": 3035
},
{
"page": 45
}
],
"title": "Moby Dick"
}
],
[
{
"bookmarks": [
{
"page": 40
}
],
"title": "Sayings of the Century"
},
{
"bookmarks": [
{
"page": 35
},
{
"page": 45
}
],
"title": "Sword of Honour"
},
{
"bookmarks": [
{
"page": 3035
},
{
"page": 45
}
],
"title": "Moby Dick"
}
]
]
Elixir (jaxon)
[]
[
[],
[
{
"page": 45
}
],
[
{
"page": 45
}
]
]
[]
JavaScript (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
JavaScript (jsonpath-plus)
[
[
{
"bookmarks": [
{
"page": 40
}
],
"title": "Sayings of the Century"
},
{
"bookmarks": [
{
"page": 35
},
{
"page": 45
}
],
"title": "Sword of Honour"
},
{
"bookmarks": [
{
"page": 3035
},
{
"page": 45
}
],
"title": "Moby Dick"
}
],
[
{
"bookmarks": [
{
"page": 40
}
],
"title": "Sayings of the Century"
},
{
"bookmarks": [
{
"page": 35
},
{
"page": 45
}
],
"title": "Sword of Honour"
},
{
"bookmarks": [
{
"page": 3035
},
{
"page": 45
}
],
"title": "Moby Dick"
}
]
]
Java (com.jayway.jsonpath)
¹
³
[]
Objective-C (SMJJSONPath)
¹
³
[]
PHP (Goessner)
²
Not found
jsonpath returned false, this might indicate an error
Python (jsonpath)
²
Not found
jsonpath returned false, this might indicate an error
Ruby (jsonpath)
[
null,
null,
null
]
Rust (jsonpath_lib)
[
{
"page": 45
},
{
"page": 45
}
]
Swift (Sextant)
[]
dotNET (JsonCons.JsonPath)
[
[
{
"bookmarks": [
{
"page": 40
}
],
"title": "Sayings of the Century"
},
{
"bookmarks": [
{
"page": 35
},
{
"page": 45
}
],
"title": "Sword of Honour"
},
{
"bookmarks": [
{
"page": 3035
},
{
"page": 45
}
],
"title": "Moby Dick"
}
]
]
dotNET (JsonPathLib)
[]
Errors
Erlang (ejsonpath)
Timeout
Perl (JSON-Path)
non-safe evaluation, died at main.pl line 11.
Rust (jsonpath_plus)
Error Parsing JSON Path:
$[*].bookmarks[?(@.page == 45)]^^^
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.