Skip to main content
Best answer

Unable to get two dimensional array

  • May 12, 2022
  • 4 replies
  • 137 views

Hi!

I get something like this webhook request:

<LoanPrograms>
<LoanProgram>
<Offers>
<Offer>
<InterestRate>5.25</InterestRate>
<APR>5.362</APR>
</Offer>
<Offer>
<InterestRate>5.499</InterestRate>
<APR>5.521</APR>
</Offer>
<Offer>
<InterestRate>5.7</InterestRate>
<APR>5.521</APR>
</Offer>
</Offers>
</LoanProgram>
<LoanProgram>
<Offers>
<Offer>
<InterestRate>3.75</InterestRate>
<APR>5.362</APR>
</Offer>
<Offer>
<InterestRate>3.75</InterestRate>
<APR>5.521</APR>
</Offer>
</Offers>
</LoanProgram>
</LoanPrograms>


Each LoanProgram object can contain a different number of Offer objects.
My task is to get the Offer fields so that it is clear which LoanProgram they belong to.

When I map the fields in the Zapier interface, it looks exactly like I want it to - in the form of a two-dimensional array.
 


BUT when I send this data to my endpoint, I lose all the square brackets and get the data just separated by commas.
 


Is there any way to get this data exactly as it is displayed in the UI?
I tried to create a code step and so on, but I still got corrupted data at the entrance to it.

Thank you!

Best answer by Troy Tessalone

@Roman Nosachev

The Code step would need to be configured to parse the raw data, which requires knowledge of Python or JavaScript to loop and traverse nested array data.

 

 

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

4 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • May 12, 2022

Hi @Roman Nosachev 

Good question.

You’ll likely need to use a Code step to handle the variable number of nested arrays.

https://zapier.com/apps/code/help

 

Consider hiring a Zapier Expert if you need help: https://zapier.com/experts


Hi @Troy Tessalone

Thank you for your answer.

Unfortunately it doesn’t work. In this variable, I already get values without square brackets, that is, everything is mixed up.

 

Code

 

Result

 

Is there any way to get the raw XML part? It looks like our integration has a serious problem.


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • Answer
  • May 12, 2022

@Roman Nosachev

The Code step would need to be configured to parse the raw data, which requires knowledge of Python or JavaScript to loop and traverse nested array data.

 

 


Thanks @Troy Tessalone 

I implemented this in code step and it wasn’t too difficult.