Skip to main content
Question

Missing JSON fields when using Zapier with API webhook

  • February 18, 2025
  • 2 replies
  • 21 views

I am calling an API through a Webhook to return shipment data. The data is a collection of nested JSON objects. When I run the API through Postman it returns the entire JSON as expected. When I run it in Zapier, not all of the JSON seems to be returned, and I’m not able to see or use all the JSON fields for subsequent actions. Is there a limit to how many levels deep Zapier will read a JSON response, or a limit to the line items it displays in the test window when testing?

This is a subset of the results from Postman showing all the expected fields.

 

And reviewing the same results in the test window, I am completely missing

subTasks
   stops
      location
        

Thanks.

Did this topic help you find an answer to your question?

2 replies

Troy Tessalone
Forum|alt.badge.img+14
  • Zapier Expert
  • 31058 replies
  • February 19, 2025

Hi ​@Craiger 

Try using the Code by Zapier app to make the app API request: https://zapier.com/apps/code/help


Forum|alt.badge.img+5

This is a known limitation, as Zapier's Webhooks can struggle with deeply nested JSON structures.

Incorporate a "Code by Zapier" step as recommended by Troy using JavaScript to manually parse the JSON response and extract the required nested fields. Here's how you can implement this:

  • Add a Code Step: After your Webhook step, insert a "Code by Zapier" action.

  • Parse the JSON: Use JavaScript to parse the JSON string and extract the necessary data. For example:

    const response = JSON.parse(inputData.response); const subTasks = response.subTasks || []; const stops = subTasks.map(task => task.stops || []); return { stops: JSON.stringify(stops) };

    This script parses the JSON and extracts the stops array from each subTask. The extracted data is then returned as a stringified JSON, which can be used in subsequent Zap steps.


If you're using a "GET" request in your Webhook, ensure that the request headers accept JSON responses. This can be done by setting the "Accept" header to "application/json" in your Webhook configuration. This informs the API to return the response in JSON format, which Zapier can then process.