title: Node.js "Foreach is not a function " error
body: <p>I am trying to parse through a nested JSON object from an API call but I keep getting the error <code>foreach</code> is not a function</p>
  <pre class="lang-js prettyprint-override"><code>request(options, function (error, response, body) {
      if (error) throw new Error(error);
  
      console.log(body);
      data = response.toJSON.;
  
      console.log(data);
  
      data.pagination.forEach(obj =&gt; {
          Object.entries(obj).forEach(([key, value]) =&gt; {
              console.log(`${key} ${value}`);
          });
          console.log('-------------------');
      });
  
  });
  </code></pre>