Best answer

Issue with Zapier Platform and JSON API object

  • 15 July 2021
  • 4 replies


I’m hoping that someone can shed some light on how to properly format incoming data in Zapier Platform UI code view.  Here is the call:

const options = {
url: '',
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Basic ${bundle.authData.client_id_key}`,
params: {
'page': + 1,
"has_email": true,

return z.request(options)
.then((response) => {
const results = response.json;

return results;

I get the error “Got a non-object result, expected an object from create ...” with this code.


If I wrap my results in an object like “return {results};” I get a successful call.  However, when working through the zap process to use the data it’s not in any usable format, see below:


“Results” is placed before all of the keys and all of the keys are in one object.  Does anyone have suggestions on how to format the data in the call to get each item in it’s own object?


Any help is appreciated.




Best answer by Zane 15 July 2021, 22:00

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

4 replies

Userlevel 7
Badge +9

Looks like results is an array.  Zapier expects a single object representing the thing the action just created. Rather than wrapping the array in brackets, I think you’re going to want to reach into the array and pull out the object that represents what you want to return to the user. If you post the contents of your results we can provide better insight, if that doesn’t get you up and running.

Hi Zane,

Thanks for the quick response.

Here is the result I need from each item in the array:

"id": 12345,
"customer": 4321,
"deleted": false,
"deleted_date": null,
"photo_url": null,
"image": null,
"mobile_phone2": "",
"mobile_phone3": "",
"home_phone": "",
"office_phone": "",
"create_source": "",
"update_source": "",
"customer_user_id": "",
"user_type": "person",
"last_login": "",
"is_superuser": false,
"is_staff": false,
"is_active": true,
"date_joined": "",
"first_name": "First",
"last_name": "Last",
"title": "",
"email": "email",
"email2": null,
"email3": null,
"mobile_phone": null,
"address": "",
"address2": "",
"city": "",
"state": "",
"country": "US",
"zipcode": "",
"notes": "",
"outbound_number": "",
"tos_accepted": "",
"password_is_temporary": false,
"date_activated": "",
"date_updated": "2",
"time_zone": "",

I’m not super familiar with the code I would need to make this happen.


Userlevel 7
Badge +9

I’m assuming your results is an array of objects like you posted; & your action somehow resulted in all of them being created, or otherwise creates a context in which a user may need to use all of that data in subsequent steps in their workflow? 

One thing I think you could do is something like

return {line_items: results};

You’d have a proper object, and you’d have a way to reference the array of items. The limitation of this approach is that to use those results, any subsequent action step will need to explicitly support “line items”, ie expect and handle an array. Or the user would have to set up a workflow with our somewhat experimental “looping” app - not super straightforward for non power users. 

Thanks for the responses, I answered my own question.  Unfortunately, it was a mistake with the action where I selected Create instead of Search, so it was looking for an object instead of an arrayof objects.

Thanks again!