Skip to main content

I am calling an API that produces a sizable JSON response. Zapier is trying to output most of the leaf nodes as values, but I want to just take the entire body into the next step.

If i am using Code by Zapier also and trying to get input data as an json i am not able to do so...as in my previous webshook step i am geeting output as JSON but Zapier is automatically spliting them and combining them in one instead of parsing same data as an json.

@Priya Mishra 

It’s a lousy workaround but you could rebuild the JSON in a code block and then return it as a string object for use in your next step. 

You may need to watch the constraints on how long a string can be, and how long the code takes to run.

 

import json

# Replace with you input_data variables
data = {
"key1": "value1",
"key2": "value2",
"nested": {
"key3": "value3"
}
}

# Convert the JSON object to a string
json_as_text = json.dumps(data)

# Return the string as output for the next Zap step
output = {"json_object": data,"json_text": json_as_text}

 


Reply