Architect Loop block skips iterations on nested JSON array from Data Action

The Loop block in Architect seems to bail out after the first item when iterating over a JSON array returned by a Data Action. The payload from the Data Action is a valid JSON array of objects, but the loop counter only increments once before the flow exits the block.

Here is the Data Action response:

[
 {"id": "1", "name": "A"},
 {"id": "2", "name": "B"}
]

The Loop block is configured to iterate over $.response.body. Is there a specific schema requirement for the Data Action output that forces the Loop block to treat it as a single object instead of an iterable list?

I’ve seen this exact behavior a few times when the Data Action output isn’t strictly a JSON array at the root level. Sometimes the wrapper adds an extra layer or returns a stringified version that Architect doesn’t parse correctly for the loop iterator.

First, check the raw output in the flow debug logs. If it looks like "[ { ... } ]" (a string) instead of an actual array structure, the Loop block will treat the whole string as a single element. You can force the parse using a Set Data block before the loop.

Try adding a Set Data block right after the Data Action:

{
 "type": "setData",
 "data": {
 "parsedArray": "{{ $.response.body | jsonParse }}"
 }
}

Then point your Loop block’s iterator to $.parsedArray. The jsonParse filter (or the equivalent expression function depending on your Architect version) ensures the engine sees a proper array object.

If that doesn’t fix it, check if your Data Action is returning a 200 OK with the array directly in the body. Sometimes if the status code is anything other than 2xx, or if the content-type header is missing application/json, Architect might fail silently or only process the first chunk.

Another gotcha is the “Max Iterations” setting on the Loop block. It defaults to 1 in some older templates. Make sure you’ve bumped that up to at least the expected array length, or set it to a high number like 1000 if the size varies.

Also, verify the iterator path. If you’re using $.response.data[0] by mistake, it’ll only grab the first item. It should be just $.response if the body is the array, or $.parsedArray if you used the fix above.

Let me know if the debug logs show the array length as 1 or if it’s actually iterating. This usually points straight to the issue.

The docs state: “The Loop block expects a valid JSON array or object at the root of the data source.”
If your Data Action returns a stringified JSON payload, the Loop block sees one element. That’s the string itself. The counter hits 1 and exits.

The point above is correct about the parsing issue. You need to verify the raw type. Use a Set Variable block right after the Data Action to log typeof($.response.data). If it says “string”, you’ve got the problem.

The docs also state: “Use the JSON.parse function to convert a stringified JSON response into a usable object or array.”
Add a Set Variable block before the Loop. Set the variable to JSON.parse($.response.data). Then point your Loop block to that new variable.

It’s a common gotcha with custom Data Actions that don’t set the correct Content-Type header. The platform treats it as text. Parse it explicitly.