Trying to fetch and parse a JSON payload from an external endpoint using the GetRESTProxy action in a CXone Studio snippet. The call succeeds (status 200), but accessing nested properties via response.body['data']['id'] returns undefined. The raw response looks correct in the debug trace, but the Studio parser seems to flatten or ignore the structure. Here’s the snippet logic:
var proxy = GetRESTProxy("my-proxy");
var req = proxy.createRequest("GET", "https://api.example.com/data");
var res = proxy.send(req);
var json = res.body;
Assign("userId", json['data']['id']); // This is blank
The JSON structure returned is:
{
"data": {
"id": "12345",
"name": "Test"
}
}
I’ve tried json.data.id and eval(json)['data']['id'] without luck. Is there a specific way to handle nested objects in the Studio SNIPPET action, or is GetRESTProxy stripping the nested keys? The docs don’t mention any parsing limitations for JSON objects.