cs_lec
August 30, 2024, 12:38am
1
Describe the problem/error/question
Hey Team! I’m not really sure how to parse a JSON array with multiple entries. Example JSON payload here for reference:
{
“data”: [
{
“token”: “Jhj5dZrVaK7ZwHHjRyZWjbDl”,
“challenge”: “This is a test input 1. Please validate.”,
“type”: “url_verification”
},
{
“token”: “Jhj5dZrVaK7ZwHHjRyZWjbDl”,
“challenge”: “This is a test input 2. Please validate.”,
“type”: “url_verification”
}
]
}
I’m trying to build a flow where I can pull out each of the entries’ challenges and map them to a singular downstream API call.
I believe that the loop over items node is how to pull this off but I’m not 100% sure. Any support is much appreciated!
n8n
August 30, 2024, 12:38am
2
It looks like your topic is missing some important information. Could you provide the following if applicable.
n8n version:
Database (default: SQLite):
n8n EXECUTIONS_PROCESS setting (default: own, main):
Running n8n via (Docker, npm, n8n cloud, desktop app):
Operating system:
cs_lec
August 30, 2024, 12:39am
3
I don’t have these specifics as my question is more general in nature. Thanks
@cs_lec , normally you do not need a loop. An API call made by, say, HTTP Request node will make individual calls for each of the items automatically (if that is what you want). You do need to split the items out (unpack from the array) first as shown below.
The outcome becomes
2 Likes
cs_lec
August 30, 2024, 6:58pm
5
Exactly what I needed. Thanks for the support here!
system
Closed
September 6, 2024, 6:58pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.