Question

Zapier Encasupulating Array with Double Quotes

  • 13 November 2022
  • 1 reply
  • 113 views

Hey Guys,

I am running into an issue here that im unsure of how to work around. Im new to Zapier and fairly new to json.

Job:

I need to have an array of products formatted in a very specific way to populate a table inside a Courier (dispatching platform).  It needs to be structured like [ [“qty”,”itemname”,”price”], [“qty”,”itemname”,”price”], [“qty”,”itemname”,”price”] ]

 

Raw Data From Website:

Data comes in like this:

Qty: 1,1,1

Product: itemname,itemname,itemname

Price: price,price,price


Where I am at right now:

This is the relevant code from my Integration:

'custom_field_template': bundle.inputData.custom_field_template, //name of the Custom Form
'meta_data': [
{
'label': 'Order_Details', //Name of the Table we are inserting into
'data': [bundle.inputData.products] // array to insert
},

 

I have used Line-Item to Text formatter to format the array. The output on the formatter is perfect:

["1","Product 1","45.00"], ["1","Product 2","160.00"], ["1","Product 3","35.00"]

 

Outcome:

'custom_field_template': bundle.inputData.custom_field_template,
'meta_data': [
{
'label': 'Order_Details',
'data': ["["1","Product 1","45.00"], ["1","Product 2","160.00"], ["1","Product 3","35.00"]"]
},

Zapier is encasing the array in “” which is causing the API call to ignore the table data.

 

I have been on this for a couple days now trying different things and I havent been able to get past this issue. Any help would be greatly appreciated.


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

1 reply

Userlevel 7
Badge +9

Hi there, @jimbob12. Thanks for reaching out in community!

I hope you don’t mind I moved your question over to our Code & Webhooks forum.

Hopefully that will get some more technical eyes on this for us. 🤗