Data Action JSON mapping fails for nested arrays in response

Building a Data Action that hits an internal REST API. The endpoint returns a JSON object with a nested array, but the mapping to Architect variables keeps failing. Here is the response payload:

{ "status": "ok", "items": [{"id": 101, "name": "test"}] }

I tried mapping items[0].id in the JSON path, but the variable stays null. Is the syntax for array indexing different in the Data Action mapper?

You’re using the wrong syntax for the JSON path in the Data Action mapper. It doesn’t support bracket notation like items[0].id for array indexing. You have to use dot notation with the index number directly attached to the key name. So, instead of items[0].id, you need to write items.0.id. This is a common gotcha when migrating from standard JavaScript or Python logic to Genesys Cloud’s internal mapping engine. The parser treats the index as part of the property name, not as an array accessor. Here is how the mapping should look in the Architect Data Action configuration:

{
 "responseMapping": {
 "itemId": "items.0.id",
 "itemName": "items.0.name"
 }
}

If you have multiple items and need to loop through them, the Data Action mapper won’t handle that automatically in a single variable assignment. You’ll need to map the entire items array to a single variable first, then use a Loop action in Architect to iterate over the array. Inside the loop, you can access the current item’s properties using $.id or $.name depending on how the loop variable is scoped. But for a single direct lookup, the dot-notation index is all you need. Make sure the external API actually returns the array structure you expect. Sometimes caching or conditional logic in the backend strips the array wrapper if only one item is returned. Test the endpoint directly with curl to verify the payload shape matches what you’re mapping against. Also, check the Data Action logs in Architect to see the raw response body. It often shows the exact JSON structure returned, which helps debug these path issues faster than guessing.