I am trying to JSON.parse the array "data." I need to be able to pass the array as the root.
{
"data": [
{
"type": "name",
"id": "123"
}
]
}
The response should look like this containing only objects. Zapier doesn't seem to work well with arrays.
{
"type": "name",
"id": "123"
}
Shouldn't I be able to use a simple script to get the job done?
EDIT:
Essentially, you're going to want to override the post_poll
method (https://zapier.com/developer/documentation/v2/scripting/#polling) 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:
xyz_post_poll: function(bundle){
var response = JSON.parse(bundle.response.content);
return response.data || [];
}