title: Why is my JSON fetch query returning undefined values?
body: <p>I am trying to find some specific data from a JSON file using the fetch query, my code so far looks like this:</p>
  
  <pre><code>function newfuntion() {
      var my_list = []
      fetch("url")
          .then(res =&gt; res.json())
          .then(data =&gt; {
              x= data.mydata.filter(el =&gt; el.Process==="process1")
              myvar = x.Shortnum
              console.log(myvar)
          })
  }
  </code></pre>
  
  <p>My issue is where I define <code>myvar</code> as <code>shortnum</code>, it cannot narrow down the query to only <code>Shortnum</code>. </p>
  
  <p>If I run this without the <code>.shortnum</code> filter it works fine. i.e. <code>console.log(x)</code> will return the dictionary where the process is <code>process1</code>.</p>
  
  <p>Here is a sample of the JSON file:</p>
  
  <pre><code>{
      "mydata": [
          {
              "Process": "process1",
              "Shortnum": "00000",
              "Status": 1,
          }
      ]
  }
  </code></pre>