title: How to extract data from JSON object
body: <p>I am using Google Script to fetch an url that returns me the following JSON object: </p>
  
  <pre><code>[
      {
          "rsid":"op-bigideas",
          "site_title":"Big Ideas",
          "evars":[
              {
                  "name":"Tracking Code",
                  "type":"text_string",
                  "id":"trackingcode",
                  "expiration_type":"week",
                  "expiration_custom_days":"1",
                  "allocation_type":"most_recent_last"
              },
              {
                  "name":"Custom eVar 1",
                  "description":"",
                  "type":"text_string",
                  "enabled":false,
                  "id":"evar1",
                  "expiration_type":"visit",
                  "expiration_custom_days":1,
                  "allocation_type":"most_recent_last"
              }
          ]
       }
    ]
  </code></pre>
  
  <p>How can I extract the <code>name</code> property from <code>evars</code> using <code>javascript</code> with <code>Google Apps Script</code>?</p>
  
  <p>This is the code that returns me the JSON object:</p>
  
  <pre><code>var elements = JSON.parse(UrlFetchApp.fetch(url, options));
  </code></pre>
  
  <p>I already tried the following but only receiving <code>undefined</code> message:</p>
  
  <p>1.</p>
  
  <pre><code>  for(var elem in elements) {
      Logger.log(elements[elem]['evars'].name);
    }
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>  for(var elem in elements) {
      Logger.log(elements[elem].evars.name);
    }
  </code></pre>
  
  <p>3.</p>
  
  <pre><code>var newData = JSON.parse(elements);
  Logger.log(newData.evars.name)
  </code></pre>