3

As an example, I have this json

{
  "machines": [
    {"name": "a", "state": "running"},
    {"name": "b", "state": "stopped"},
    {"name": "b", "state": "running"}
  ]
}

and my query is machines[?state=='stopped'].name which gives the result of ["b"]

but instead I want to get the path of that result e.g. machines[1] or machines[1].name

I know this can be done with jsonpath-ng in python, but I want to use jmespath.

KKS
  • 458
  • 5
  • 10

0 Answers0