title: Accessing nested JSON Value with variable key name in Logstash
body: <p>I've got a question regarding JSON in Logstash.
  I have got a JSON Input that looks something like this:</p>
  
  <pre><code>{
  "2": {
          "name": "name2",
          "state": "state2"
      },
  
  "1": {
          "name": "name1",
          "state": "state1"
      },
  
  "0": {
          "name": "name0",
          "state": "state0"
      }
  }
  </code></pre>
  
  <p>Now, let's say I want to add a field in the logstash config</p>
  
  <pre><code>json{
      source =&gt; "message"
      add_field =&gt; {
              "NAME" =&gt; "%{ What to write here ?}"
              "STATE" =&gt; "%{ What to write here ?}"
      }
  }
  </code></pre>
  
  <p>Is there a way to access the JSON Input such that I get a field Name with value name1, another field with name 2 and a third field with name 3. The first key in the JSON is changing, that means there can only be one or many more parts. So I don't want to hardcode it like </p>
  
  <pre><code>%{[0][name]}
  </code></pre>
  
  <p>Thanks for your help.</p>