Best answer

Trouble parsing JSON arrays

  • 21 May 2021
  • 1 reply


Thanks for posting this. I came across it looking for a solution to this issue, but mine is a bit more complex so the above doesn’t work exactly as expected.

My data comes comes in an array where each object can have a slightly different schema. To give an example, each object in the array might have a Description, so say a 3 item array will come through as Description like Item1,Item2,Item3 but say only Item1 and Item3 has a property called Rate, and that will come through as Rate1,Rate3

You can see how solutions that manipulate strings can come up short in this situation - the descriptions don’t line up to the corresponding rates and concatenating these into a string and parsing that will give unexpected results.

Ideally I’d just like to take the raw JSON output of the trigger (it’s Qwilr btw) and send it out as-is in another action, but I can’t see how to do this so I’m trying to reconstruct an array back into a format I can reliably parse.

What is the best solution to this problem?


Best answer by SamB 2 September 2021, 10:34

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.

1 reply

Userlevel 7
Badge +11

Hey @Will Page,

I know I’m a bit late to the party here, so you may have already solved this, but I wanted to make a suggestion here in case it helps!

It sounds like you’re wanting to parse some nested array fields, correct? If so, you could try using a Code step to parse the JSON payload you receive (presumably coming from a Catch Raw Webhook step) and extract all the field values you need.


I’m by no means an expert on all this but I know that Code steps have a built-in library function called JSON.parse that you could use to do that. Here's an example of what I’m thinking of here:


And if you’re looking to just send the raw JSON output onward, I’d recommend using a Custom Request (Webhooks by Zapier) action to do that - I need to send a nested JSON array in the request data


Hope this helps! :)