Best answer

Unable to get two dimensional array


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!

icon

Best answer by Troy Tessalone 12 May 2022, 16:21

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.

4 replies

Userlevel 7
Badge +14

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.

Userlevel 7
Badge +14

@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.