Ran into a weird issue today with the Loop block in Architect. I’m trying to iterate over a JSON array returned from a custom Data Action. The Data Action calls a simple GET endpoint on our internal API and returns a list of objects.
Here is the payload I’m seeing in the debug logs:
[
{"id": "1", "name": "Test"},
{"id": "2", "name": "Test2"}
]
I have the Loop block configured to use the Data Action output as the source. I’m setting the iteration variable to item. Inside the loop, I try to assign item.id to a session variable.
The loop seems to execute once but the values are undefined. If I log the raw output of the Data Action, it looks correct. But the Loop block treats it like a single string object instead of an array.
I’ve tried wrapping the Data Action output in a JSON parse function in a preceding script block, but that just throws a syntax error in Architect.
Is there a specific way to format the response from the Data Action so the Loop block recognizes it as an iterable array? Or am I missing a configuration flag on the Loop block itself?