CXone Studio Snippet: Parsing nested JSON from REST Proxy fails with type mismatch

Can’t get this config to load properly… I have built a typed Python client for Genesys Cloud, but now I need to integrate a CXone Studio flow that calls an external REST endpoint. I am using the GetRESTProxy snippet action to POST a JSON payload to a custom webhook. The response returns a 200 OK with a valid JSON body like {"status": "success", "data": {"id": 123, "name": "test"}}. However, when I try to extract the nested id field into a flow variable using the ASSIGN action, the script throws a runtime error: Error converting value to type: Integer. I have verified the variable type in Studio is set to Integer. The expression I am using in the ASSIGN action is {{RESTProxyResponse.data.id}}. Is the REST Proxy response object structured differently than standard JSON? Or do I need to parse the raw string response first? Here is the snippet configuration:

GetRESTProxy → Method: POST, URL: https://example.com/api, Body: {"key": "value"}
ASSIGN → Target: flowVars.customerId, Source: {{RESTProxyResponse.data.id}}

The error log shows the source value is being treated as a string or null. How should I correctly dereference nested properties in the Studio snippet context?

This looks like a basic jsonpath syntax error. cxone studio expects strict paths. use $.data.id in the mapping field.

$.data.id

If I remember correctly, Studio often treats raw JSON responses as strings unless explicitly parsed first.

TypeError: Cannot read property ‘id’ of undefined

  1. Insert a Parse JSON snippet before the mapping.
  2. Set the input to the REST response body.
  3. Reference the parsed object using $.data.id in the subsequent assignment.

The quickest way to solve this is to explicitly parse the response string into an object before attempting the nested lookup.

let parsedResponse = JSON.parse(restResponse.body);
flow.setVariable("customerId", parsedResponse.data.id);

Studio treats the raw body as a string by default, so you’ll hit that type mismatch without the explicit parse step.