title: Reference a set variable while extracting from JSON
body: <p>I am trying to dynamically load parts of a JSON object using a set variable, the reason for this is so that when a user navigates to 'page 3', I can request the third child of a JSON snippet to load the relevant data.</p>
  <p>I want to be able to dynamically pick that I'd like &quot;2&quot;, like so:</p>
  <pre><code>  var steps = (data)
  
    const x = '2'
    console.log(steps[x])
  </code></pre>
  <p>When doing so in a react-native iOS environment, I get:</p>
  <blockquote>
  <p>TypeError: undefined is not an object (evaluating 'steps[x]')</p>
  </blockquote>
  <hr />
  <p><strong>My JSON (data):</strong></p>
  <pre><code>{
     &quot;0&quot;:{
        &quot;action&quot;:&quot;########&quot;,
        &quot;detail&quot;:&quot;########&quot;,
        &quot;items&quot;:&quot;########&quot;,
        &quot;meta&quot;:&quot;########&quot;,
        &quot;name&quot;:&quot;Check Equipment&quot;,
        &quot;scope&quot;:&quot;equipment&quot;,
        &quot;type&quot;:&quot;instruction&quot;
     },
     &quot;1&quot;:{
        &quot;action&quot;:&quot;########&quot;,
        &quot;detail&quot;:&quot;########&quot;,
        &quot;items&quot;:&quot;########&quot;,
        &quot;meta&quot;:&quot;########&quot;,
        &quot;name&quot;:&quot;Check Out Equipment&quot;,
        &quot;scope&quot;:&quot;equipment&quot;,
        &quot;type&quot;:&quot;scan&quot;
     },
     &quot;2&quot;:{
        &quot;action&quot;:&quot;########&quot;,
        &quot;detail&quot;:&quot;########&quot;,
        &quot;items&quot;:&quot;########&quot;,
        &quot;meta&quot;:&quot;########&quot;,
        &quot;name&quot;:&quot;Start Job&quot;,
        &quot;scope&quot;:&quot;job&quot;,
        &quot;type&quot;:&quot;instruction&quot;,
     },
     &quot;3&quot;:{
        &quot;action&quot;:&quot;########&quot;,
        &quot;detail&quot;:&quot;########&quot;,
        &quot;items&quot;:&quot;########&quot;,
        &quot;meta&quot;:&quot;########&quot;,
        &quot;name&quot;:&quot;Confirm Job&quot;,
        &quot;scope&quot;:&quot;job&quot;,
        &quot;type&quot;:&quot;instruction&quot;
     }
  }
  </code></pre>