In XPath, to search for any descendants that match a certain path, say, a elements at any level with a b element as a child, one would use the query //a/b.
E.g., for the following document
<foo>
<bar>
<a><b>first</b></a>
</bar>
<a><b>second</b></a>
</foo>
using the aforementioned xpath, we would find the elements <b>first</b> and <b>second</b>.
Is there an equivalent for JSON and JMESPath?
E.g.:
{
"foo": {
"bar": {
"a": {"b": "first"}
},
"a": {"b": "second"}
}
}
From the above document, is it possible to retrieve {"b": "first"} and {"b": "second"}?
No. The below query
gives
and
gives