I’m trying to map a nested JSON response from an external REST API to Architect variables in a Data Action. The API call succeeds with a 200, but the variable assignment fails silently. Here’s the mapping config I’m using:
{
"variableName": "customerName",
"dataSource": "response.body",
"path": "data.profile.name"
}
The actual response looks like this:
{
"status": "ok",
"data": {
"profile": {
"name": "John Doe"
}
}
}
Am I missing something with the path syntax?
The silent failure usually hits when the path string doesn’t exactly match the JSON structure. Architect’s mapping is strict. If data.profile.name isn’t a leaf node, it won’t bind. Try logging the raw body to a string variable first. Then parse it in a subsequent step to verify the actual key names.
Cause: Architect’s built-in JSON path parser doesn’t handle nested objects well when the response body is treated as a raw string or if the JSON structure has dynamic keys. The silent failure happens because the mapping engine can’t resolve data.profile.name if data is an array or if profile is null. Also, Architect variables don’t support object types, so you can’t map a whole JSON chunk to a single variable. You need to flatten it.
Solution: Don’t rely on the visual mapper for complex JSON. Use a Studio script to parse the response and set the specific string values. It’s cleaner and gives you error handling.
Create a Studio script with a REST Proxy step to call your API. Then use a Script step to parse the result.
// Studio Script Step: Parse JSON
ASSIGN raw_response = GetRESTProxy("myApiEndpoint").Exec()
ASSIGN parsed_json = JSON.parse(raw_response.body)
// Check if the path exists to avoid null errors
ASSIGN name = ""
IF parsed_json.data != null AND parsed_json.data.profile != null {
name = parsed_json.data.profile.name
}
// Set the Architect variable
SetVariable("customerName", name)
This approach bypasses the mapper’s limitations. You get full control over null checks. If the API returns a list, you can loop through it. If it’s a single object, you extract the exact field. No more silent failures.
One gotcha: make sure your REST Proxy step has the correct headers. If the API requires auth, set it in the Proxy config, not in the script. Also, check the response type. If it’s not application/json, the parse will fail. Add a try-catch block if you’re dealing with unreliable APIs.
TRY {
ASSIGN parsed_json = JSON.parse(raw_response.body)
} CATCH (error) {
Log("Parse error: " + error.message)
ASSIGN name = "Unknown"
}
This keeps your flow stable.