Question

Code for Zapier object output

  • 7 December 2023
  • 2 replies
  • 84 views

Userlevel 1

Hi I’m trying to output an object (possibly as JSON if possible too) to pass into the next step of the Zap to use as the payload/body for an Airtable API.

This is the code output, which shows as expected:

 

 

But the issue is, in the next step I don’t just have one output to use, it seems to have split up my object into separate “tags” to use in the step:

This is of no use to me though! How can I make it just pass the whole object from the script as a single tag?

 

Thanks

 

Edit: here’s the `cosole.log` of the `fields` var for context

{
"fields": [
{
"name": "Day",
"type": "singleLineText",
"description": "{SHOW} & ' - ' & {IMAGE} & ' - ' & {Playlists/Showlists} & ' - ' & WEEKDAY & ' - ' & DATE"
},
{
"name": "Hero Position",
"type": "singleLineText"
},
{
"name": "SHOW",
"type": "singleLineText"
},
{
"name": "IMAGE",
"type": "singleLineText"
},
{
"name": "ABC.COM",
"type": "singleLineText"
},
{
"name": "iOS/Android",
"type": "singleLineText"
},
{
"name": "OTT",
"type": "singleLineText"
},
{
"name": "Marketing Modules",
"type": "singleLineText"
},
{
"name": "Playlists/Showlists",
"type": "singleLineText"
},
{
"name": "ABC News Live",
"type": "singleLineText"
},
{
"name": "SVOD",
"type": "singleLineText"
},
{
"name": "ON NOW ROW - LIVE",
"type": "singleLineText"
},
{
"name": "ON NOW ROW HP (ENTERTAINMENT)",
"type": "singleLineText"
},
{
"name": "ON NOW ROW HP (NEWS)",
"type": "singleLineText"
},
{
"name": "ON NOW ROW HP (NAT GEO)",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "F.C. SHOW PAGE MM",
"type": "singleLineText"
},
{
"name": "FOOTBALL",
"type": "singleLineText"
},
{
"name": "",
"type": "singleLineText"
},
{
"name": "DATE PERIOD",
"type": "singleLineText"
},
{
"name": "DATE",
"type": "singleLineText"
},
{
"name": "WEEKDAY",
"type": "singleLineText"
},
{
"name": "ROW ID",
"type": "singleLineText"
},
{
"name": "WORKSHEE",
"type": "singleLineText"
}
]
}

 


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

2 replies

Userlevel 7
Badge +14

Hi @Katrina_Storm 

Good question.

Try asking ChatGPT for help with the Code.

Can you provide more context about how your are trying to use the Code output in following Zap steps? (screenshots)

Userlevel 1

To pass a full object like that between steps you can convert to a json string in the output and then parse that in the next step.

(this is python but similar functions exist in JS)

So in the output 

 output["my_object"]=json.dumps(raw_object)


And then on later step:

my_object= json.loads(input_data['my_object'])