Data Action HTTP POST response mapping failing with 400

Trying to set up a Data Action that calls our internal CRM endpoint to fetch customer tier. The HTTP action fires correctly and returns a 200 with valid JSON, but Architect throws a validation error when I try to map the response body to a string variable.

The endpoint returns:

{"tier": "gold", "status": "active"}

I mapped the JSON path to $.tier in the response mapping section. The variable type is set to String. When I test the flow, the action fails with Invalid response format: expected string but found object.

I tried mapping to $.tier directly. I also tried using a JSON path expression like $.tier inside a nested object mapper, but that just returns null. The raw response log shows the JSON is clean. No extra whitespace.

Is there a specific way to unwrap the JSON response in the Data Action response tab? Or do I need to use a to parse the raw body first? I’ve checked the docs and they only show simple key-value mappings, not nested JSON extraction.

Here is the mapping config I’m using:

Response Variable: custTier
JSON Path: $.tier

Any ideas why it’s treating the string value as an object?

The $.tier path is correct, so the 400 is almost certainly coming from a type mismatch or a silent parsing failure on the Architect side.

First, check the raw response header. If your CRM is sending Content-Type: text/plain or application/octet-stream, the Data Action won’t parse it as JSON automatically, even if the payload looks valid. You’ll need to force the parser or handle it differently.

Second, and more likely, is the variable type. If you mapped $.tier to a variable set to “String”, it should work. But if that variable was previously populated in the flow with a number or object, Architect’s strict typing might reject the overwrite.

Here’s a safer pattern I use in Node.js integrations when dealing with inconsistent upstream responses. Instead of mapping directly in the Data Action, map the entire body to a JSON type variable, then use a Script block or a subsequent Data Action to extract the specific field.

If you want to stay purely in Architect, try this:

  1. Create a temporary variable called rawResponse of type JSON.
  2. Map the Data Action output to rawResponse using the path $ (root).
  3. Use a “Set Variable” action to set your customerTier (String) to rawResponse.tier.

This decouples the HTTP response parsing from the final variable assignment. It also lets you inspect rawResponse in the flow logs if it fails, which is way easier than guessing why a direct map threw a 400.

Also, double-check that your CRM endpoint isn’t returning a BOM (Byte Order Mark) at the start of the JSON. Node.js JSON.parse handles it gracefully sometimes, but Architect’s parser can be picky. If you see a weird character before the { in the trace, that’s your culprit.

// Expected clean JSON
{
 "tier": "gold",
 "status": "active"
}

// Problematic JSON with BOM (often invisible in logs)
{\uFEFF"tier": "gold", "status": "active"}

If it’s the BOM, you might need a small middleware or a Script block in Architect to strip it before mapping.