I can’t seem to figure out why the Loop block in my Architect flow is not iterating correctly. I have a Data Action that returns a JSON array of contact details. The Data Action itself succeeds and returns status 200. I checked the response payload in the debug logs. It looks like this:
[
{
"id": "101",
"name": "John Doe"
},
{
"id": "102",
"name": "Jane Smith"
}
]
The documentation states “The Loop block iterates over each item in a list or array.” I configured the Loop block to use the output variable contacts_list from the previous Data Action step. I set the loop variable to current_contact. Inside the loop, I tried to access current_contact.name. However, the flow logs show that the loop only executes once. It seems to treat the entire JSON array as a single string object instead of an array of objects.
I am using v2.0 of the Architect environment. I tried adding a transformation step to parse the JSON string into a list using the JSON.parse function in an expression, but that caused a syntax error. The docs say “Expressions support standard JavaScript functions.” So I wrote this expression:
JSON.parse(${data_action_response.body})
This resulted in an error: “Invalid expression syntax.”
Why is the Loop block not recognizing the array structure? Do I need to map the Data Action output to a specific list type before passing it to the Loop? The documentation does not specify how to handle raw JSON arrays returned from external APIs. I am just copying the example from the guide where they iterate over a simple list of strings. This is different. The data is complex objects.
Please provide the correct configuration for the Loop block input when the source is a JSON array from a Data Action. I need to process each contact ID separately for the next API call. The current setup fails to extract individual items. I am stuck on this for two days. Any code example for the expression mapping would be helpful.