title: How to loop through JSON response in Javascript to get specific data
body: <p>I am learning how to make API requests using Javascript.</p>
  
  <p>I have made a GET request and got the following data and I would like to loop through them to get only <strong>id</strong>, <strong>display_name</strong> and <strong>email</strong>. This are to be stored in arrays. How do I complete the javascript code?</p>
  
  <pre><code>"data": [
          {
              "id": 222226,
              "display_name": "jane Doe",
              "email": "janeDoe@testmail.com",
          },
          {
              "id": 1111226,
              "display_name": "james",
              "email": "james@testmail.com",
          },
      {
              "id": 11126,
              "display_name": "Travis Mc",
              "email": "travis@testmail.com",
           },
  </code></pre>
  
  <p>Heres is my javascript code.</p>
  
  <pre><code>var options = {
          method: 'get',
          headers: {
              Authorization: 'Bearer ' + auth
          }
      };
      var response= UrlFetchApp.fetch(url, options);
      var data = JSON.parse(response.getContentText());
  </code></pre>
  
  <p>I am not sure I am doing this loop part right.</p>
  
  <pre><code>for (var i = 0; i &lt; data.length; i++) {
      Logger.log(data[i].display_name);
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LoipT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LoipT.png" alt="enter image description here"></a></p>