Skip to main content

This problem has been bothering me for several days

Phenomenon:
I sent an HTTP request to Microsoft TODO, and the HTTP response sent back contained a nested array


Zapier seemed to parse the HTTP response JSON directly for me. When I referenced the nested array, it returned all the results instead of returning the corresponding nested array according to each row of data

When I referenced this nested array in a loop, I could only select the items that Zapier helped me parse

There should be only two pieces of data in my nested array, but now the data set of all nested arrays is returned

 

So,

Question 1:
When the JSON of the API response contains a nested array, how do I reference this project

Question 2:
When I loop the JSON result of the API response, how do I also loop this nested array

 

If you can help me solve these two problems, I would be very grateful

 

Hi @Mask 

There should be a variable that returns the RAW JSON of the API response.

You can use a Code step to parse the JSON however you’d like.

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


I have tried the code component, but here in [input Data] I can only select [4.Response Data Value Checklist Items Display Name], and what I really want to loop is [4.Response Data Value], because my data format is as follows

[{

titile: task1,

checklistitems:[ {dsiplay Nmae: item1},{dsiplay Nmae: item2}]

}]

 

Can you tell me the correct way to quote?

 

When using the loop component, the result returned is like this. I don't know which step is wrong. I should have looped through the checklistitems of each row of data, but the result returned is the merged result of all the checklistitems.

 


@Mask 

The Microsoft API Request Zap step should return 1 variable called “Response Body” that contains the RAW JSON of the API response.

You would use that 1 variable as the INPUT variable for the Code step.

 


Thank you very much. I can make the correct reference according to your method.

However, I encountered a problem when using the python code. I want to get my nested set checklistItems, but it always prompts me that it is incorrect. I don’t know where I wrote it wrong. Can you help me check it?

 


@Mask 

Try asking ChatGPT for help with configuring the Python Code.

OR
Try using the AI assistant within the Code step.

 


Thank you very much for your help.

My Python skills are not very good. Now I can perfectly obtain the API request results and successfully read the nested content. Thank you very much

 

I hope this issue can help others🤣


Hi @Mask,

 

Fantastic! Glad to hear Troy's solution did the trick. This will be super helpful for other Community members facing the same problem. Thanks for sharing!