title: Getting specific output from JSON to an array
body: <p>I've had some help on here which has given me the following code:</p>
  
  <pre><code>const result = data.report.data.reduce((r, e) =&gt; {
    e.breakdown.forEach(el =&gt; {
      let key = "data";
      if(!r[key]) r[key] = []
      r[key].push(...el.counts)
    })
    return r;
  }, {})
  </code></pre>
  
  <p>This gives me this output:</p>
  
  <pre><code>Object
  data: (3) ["558045", "552531", "522877"]
  __proto__: Object
  </code></pre>
  
  <p>However, the problem is my charting software is expecting the following:</p>
  
  <pre><code>["558045", "552531", "522877"]
  </code></pre>
  
  <p>How can I adjust my code above to actually just give me the above output instead? I tried simply removing the line:</p>
  
  <pre><code>let key = "data";
  </code></pre>
  
  <p>But it gives this error:</p>
  
  <pre><code>(index):73 Uncaught ReferenceError: key is not defined
      at e.breakdown.forEach.el ((index):73)
      at Array.forEach (&lt;anonymous&gt;)
      at data.report.data.reduce ((index):72)
      at Array.reduce (&lt;anonymous&gt;)
      at window.onload ((index):71)
  </code></pre>