title: How do I JSON.parse an array in a Zapier Trigger?
body: <p>I am trying to JSON.parse the array <strong>"data."</strong> I need to be able to pass the array as the root.</p>
  
  <pre><code>{
    "data": [
      {
        "type": "name",
        "id": "123"
      }
    ]
  }
  </code></pre>
  
  <p>The response should look like this containing only objects. Zapier doesn't seem to work well with arrays.</p>
  
  <pre><code>{
        "type": "name",
        "id": "123"
  }
  </code></pre>
  
  <p>Shouldn't I be able to use a simple script to get the job done?</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>Essentially, you're going to want to override the <code>post_poll</code> method (<a href="https://zapier.com/developer/documentation/v2/scripting/#polling" rel="noreferrer">https://zapier.com/developer/documentation/v2/scripting/#polling</a>) in scripting so you can intercept the response of the API. After that, you just need to return a new object with the values you want. Instead of returning: {"data":[ {...}, {...}, ]}, you just need to return the value of data. Something like:</p>
  
  <pre><code>xyz_post_poll: function(bundle){
    var response = JSON.parse(bundle.response.content);
    return response.data || [];
  }
  </code></pre>