There's an example of search in the tutorial going:
{
"machines": [
{"name": "a", "state": "running"},
{"name": "b", "state": "stopped"},
{"name": "b", "state": "running"}
]
}
In [68]: jmespath.search("machines[?state=='running'].name",p)
Out[68]: ['a', 'b']
However, my structure uses a dictionary rather than a list, e.g.:
In [64]: q={
...: "machines": {
...: "m1": {"name": "a", "state": "running"},
...: "m2": {"name": "b", "state": "stopped"},
...: "m3": {"name": "c", "state": "running"}
...: }
...: }
My different attempts to parse this have failed:
In [65]: jmespath.search("machines[?state=='running'].name",q)
# no output
In [66]: jmespath.search("machines.*[?state=='running'].name",q)
Out[66]: []
In [67]: jmespath.search("machines[*][?state=='running'].name",q)
# no output
How can I perform this search?