Genesys Cloud Architect Data Action: Mapping nested JSON response to custom variables

I’m building a Data Action in Genesys Cloud Architect to call an external REST endpoint for customer loyalty points. The GET request to https://api.loyalty-provider.com/v1/user/${session.Phone} works fine, returning a 200 OK. The issue is mapping the response. The JSON comes back like this:

{
 "status": "success",
 "data": {
 "points": 1500,
 "tier": "Gold"
 }
}

In the Data Action JSON definition, I tried mapping $.data.points to the output variable LoyaltyPoints, but it always comes back as null in the flow. I’ve verified the endpoint returns valid JSON with Content-Type: application/json. I’m using the rest action type in the Data Action config.

Is there a specific syntax for nested object extraction in the responses mapping array? Or do I need to flatten the JSON on the server side first? I’ve checked the Genesys docs, but the examples only show flat structures. Here’s a snippet of my mapping config:

{
 "responseMapping": {
 "LoyaltyPoints": "$.data.points",
 "TierLevel": "$.data.tier"
 }
}

Any ideas why $.data.points isn’t resolving? I’ve tried $.data['points'] too, no luck.

You’re overcomplicating the mapping. Architect Data Actions don’t parse nested JSON automatically in the output schema. You need to use the expression field with dataPath or just map the raw body and parse it downstream.

Here’s the working Data Action definition. Note the outputs section. I’m mapping the specific nested fields using dot notation in the dataPath. This works for standard JSON responses.

{
 "name": "GetLoyaltyPoints",
 "type": "rest",
 "config": {
 "method": "GET",
 "url": "https://api.loyalty-provider.com/v1/user/${session.Phone}",
 "headers": {
 "Authorization": "Bearer ${secret.ApiKey}"
 }
 },
 "outputs": [
 {
 "name": "points",
 "dataPath": "$.data.points",
 "type": "number"
 },
 {
 "name": "tier",
 "dataPath": "$.data.tier",
 "type": "string"
 },
 {
 "name": "status",
 "dataPath": "$.status",
 "type": "string"
 }
 ]
}

After you save this, reference ${data.points} and ${data.tier} directly in your Architect flow blocks. No extra parsing needed.

If the provider returns inconsistent nesting, or if dataPath fails for some reason (it sometimes chokes on deeply nested arrays), fallback to mapping the entire body as a string, then use a Script block in Architect to parse it via JSON.parse(body).data.points. But try the dataPath first. It’s cleaner.

Also, make sure your phone number format matches exactly what the loyalty API expects. E.164 vs local format breaks the lookup silently. Add a Transform block before the Data Action to normalize ${session.Phone} to E.164 if you haven’t already.

Check the Data Action logs in Architect after a test run. If points comes back null, the JSON structure likely shifted or the API returned an error payload that looks like success. Log the raw body output to verify.