title: JMESPath current array index
body: <p>In JMESPath with this query:</p>
  
  <pre><code>people[].{"index":@.index,"name":name, "state":state.name}
  </code></pre>
  
  <p>On this example data:</p>
  
  <pre><code>{
    "people": [
      {
        "name": "a",
        "state": {"name": "up"}
      },
      {
        "name": "b",
        "state": {"name": "down"}
      },
      {
        "name": "c",
        "state": {"name": "up"}
      }
    ]
  }
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>[
    {
      "index": null,
      "name": "a",
      "state": "up"
    },
    {
      "index": null,
      "name": "b",
      "state": "down"
    },
    {
      "index": null,
       "name": "c",
       "state": "up"
    }
  ]
  </code></pre>
  
  <p>How do I get the index property to actually have the index of the array? I realize that <code>@.index</code> is not the correct syntax but have not been able to find a function that would return the index. Is there a way to include the current array index?</p>