It doesn't look like jmespath can provide context for a query result
kintarowins opened this issue · 3 comments
kintarowins commented
for example I would like to query people[?first=='James'].last
with this json
{
"people": [
{"first": "James", "last": "d"},
{"first": "Jacob", "last": "e"},
{"first": "Jayden", "last": "f"},
{"missing": "different"}
],
}
and instead of just getting the result d
, I'd like to also get the full path to it .e.g people[0].last
springcomp commented
The upcoming let()
function in JMESPath Community is specifically designed to achieve this scenario.
kintarowins commented
Thanks @springcomp. That's cool although I still can't grasp the example given in the preview documentation. My use-case is straight-forward, given a search expression, return the full path to the result.
springcomp commented
Oh maybe I misconstrued your example.
Unfortunately no, that's not something that would be easily done in the general case I'm afraid. Seems similar to this request if I'm not mistaken?