Architect Data Action returning undefined in success output β€” JSON path mapping issue

Stuck on a Data Action returning undefined in the success output - JSON path mapping issue.

  • Using a REST Get Data Action against a custom endpoint.
  • The response body is {"status": "ok", "payload": {"id": 123}}.
  • I mapped the output field to $.payload.id in the Architect UI.
  • The debug log shows the Data Action succeeded but the output variable is undefined.
  • I verified the endpoint returns 200 OK with valid JSON.
  • Is the JSON path syntax case-sensitive or does it require explicit array indexing for root objects?

you need to check if the response is an array. if the api returns a list, you must index it. try $.payload[0].id instead of $.payload.id. also verify the content-type header is application/json. sometimes architect fails to parse xml or plain text automatically.

1 Like

Have you tried validating the raw response payload against the expected schema before mapping? The undefined result usually indicates a JSON parsing failure or a type mismatch in the Architect Data Action configuration. If the endpoint returns a string instead of a JSON object, the JSON path $.payload.id will fail silently. Check the Content-Type header in the response. It must be application/json. If it is text/plain, Architect will treat the body as a string, breaking the path extraction.

To debug, add a Transform Data action immediately after the REST call to log the raw body. Use this expression to inspect the type:

if (typeof $DataActionOutput.body === 'string') {
 // Parse manually if needed
 let parsed = JSON.parse($DataActionOutput.body);
 return parsed.payload.id;
}
return $DataActionOutput.body.payload.id;

Also verify the Success Condition in the Data Action. If the HTTP status is 200 but the body contains an error flag like {"status": "error"}, the action might still succeed technically but return malformed data. Ensure your custom endpoint strictly adheres to RFC 8259 JSON standards. No trailing commas, proper double quotes.

3 Likes

The best way to fix this is to verify the Content-Type header.

  • Ensure the endpoint returns application/json.
  • If it returns text/plain, Architect fails to parse JSON paths.
  • Add a Data Action before the REST call to set the header if needed.

This looks like a Content-Type parsing issue.

β€œThe debug log shows the Data Action succeeded but the output variable is undefined.”

Architect ignores JSON paths if the header isn’t application/json. Add this header to the request config:

{
 "Content-Type": "application/json",
 "Accept": "application/json"
}