Just noticed that the Loop block in Architect chokes on the JSON array returned by my external Data Action. The payload is a standard list of objects, but the loop never iterates, defaulting to the error branch immediately.
Here is the response structure:
[ {"id": 123, "name": "Test"} ]
Is there a specific schema requirement for the Data Action output that enables the Loop iterator?
I’d recommend looking at at the exact schema definition of the Data Action’s output versus what the Loop block expects. The Loop block in Architect does not natively iterate over a raw JSON array returned from an external Data Action without explicit parsing or mapping. The payload structure [ {"id": 123, "name": "Test"} ] is valid JSON, but Architect’s internal variable engine often fails to recognize it as an iterable collection if the Data Action is configured to return a generic object type rather than a specific array of objects.
In my Electron-based softphone integration, I encountered similar issues when handling WebRTC session descriptions that required array processing. The solution lies in ensuring the Data Action explicitly defines its return type as an array. If you are using a custom integration, verify that the output schema in your Data Action configuration includes "type": "array" and "items": { "type": "object", "properties": { "id": { "type": "integer" }, "name": { "type": "string" } } }. Without this explicit typing, the Loop block treats the entire JSON string as a single object, causing the iteration to fail immediately.
Additionally, check if you need an intermediate “Set Variable” block to explicitly cast the Data Action output to a collection variable before passing it to the Loop. This is a common gotcha when integrating external APIs that return dynamic JSON. If the Data Action is a simple REST call, ensure the response body is being parsed correctly by Architect’s JSON parser. You can also test this by logging the variable type in a “Log” block before the Loop to confirm it is recognized as a collection. If the type shows as “object” or “string”, you will need to adjust your Data Action’s schema or add a transformation step using a JavaScript snippet within Architect to convert the response into a proper iterable array. This ensures the Loop block can correctly enumerate each item in the sequence.
Is there a specific schema requirement for the Data Action output that enables the Loop iterator?
The Loop block expects an object with a specific array property, not a raw JSON array. Map the Data Action output to {"items": <payload>} in the preceding Set Variable block to ensure correct iteration.
You need to ensure the Data Action output is explicitly typed as an array in the Architect variable definition, not just a raw JSON string. The Loop block fails because it cannot infer the iterable type from a generic string payload.
{
"items": [
{"id": 123, "name": "Test"}
]
}
Wrap the array in an object with a known key like items as suggested above. Then, in your Set Variable block, map the Data Action’s raw response to this structure. Crucially, you must define the target variable in Architect with the type “Array” and specify the schema of the inner object. If the variable is set as “String” or “Object”, the Loop block will see a single item, not a collection. Verify the variable definition matches the JSON structure exactly; type mismatches here are silent failures that route to the error branch without clear logs.
You need to verify that the Data Action output is explicitly typed as an array in the Architect variable definition, not just a raw JSON string, because the Loop block fails to infer the iterable type from a generic payload. Wrap the array in an object with a known key like items as suggested above, then map the Data Action’s response to that specific property in the preceding Set Variable block to ensure correct iteration.