CXone Studio: GetRESTProxy response parsing and JSON path extraction

Stuck on parsing a JSON response inside a CXone Studio Snippet. I’m calling an external service via GetRESTProxy to fetch user attributes. The call succeeds, status code is 200. The response body looks correct in the debug trace.

Here’s the snippet:

SET restProxy = GetRESTProxy("my-proxy");
SET response = restProxy.Execute("GET", "/users/123", {}, {});
SET status = response.StatusCode;
SET body = response.Body;
SET userData = response.Data;

body contains the raw string. userData is null. I need to extract a specific field, say email. The docs mention using JSONPath, but I can’t find the exact syntax for the Snippet language. Is there a built-in function like ParseJSON or do I have to use a regex match on the body string? Tried response.Data.email and it errors out with Cannot read property 'email' of null.

Any pointers on the correct way to drill into the JSON object in Studio?

Cause: Studio’s response.Data is often a string, not a parsed object. You can’t chain properties on a string.

Solution: Parse it first.

SET bodyStr = response.Body;
SET parsedObj = JSON.parse(bodyStr);
SET userData = parsedObj.attributes;

Docs say “Body is a string representation”.

  • That JSON.parse fix is spot on since Studio’s response is always a raw string anyway.
  • Don’t juggle variables in the flow, just pipe the parsed payload into a Lambda Data Action and dump it straight into an S3 bucket.