CXone Studio: Nested IF block fails to evaluate boolean from GetRESTProxy JSON

I’m trying to parse a boolean flag from a GetRESTProxy response in a CXone Studio snippet and branch based on it. The external endpoint returns {"is_active": true}. I have an ASSIGN block that sets ${is_active} using the JSON path $.is_active. The variable looks correct in the debug view, but the subsequent IF block IF (${is_active} == true) always evaluates to false, even when the value is clearly true. Here is the snippet structure:

<ASSIGN target="is_active" value="${GetRESTProxy_Response.body}.is_active" />
<IF condition="${is_active} == true">
 <SET target="route" value="premium" />
</IF>

The logic works fine with string comparisons, but booleans seem to behave differently. Is there a specific way to cast or reference this in the IF condition? I’ve tried ${is_active} == 'true' and it still fails.

The issue is almost certainly a type mismatch. The GetRESTProxy returns the value as a JSON literal, which CXone Studio often treats as a string "true" rather than a boolean true. When you compare a string to a boolean, it fails.

Try casting the variable to a boolean in the assignment or the condition. In the IF block, use IF (${is_active} == "true") to see if it passes. If that works, you know it’s a string.

To fix it cleanly, update the ASSIGN block to explicitly convert it:

// ASSIGN block expression
Boolean(JSON.parse(${get_rest_proxy_response.body}).is_active)

Or, if you’re stuck with the raw string, just compare against the string literal in your logic.

IF (${is_active} == "true")

Double check the debug trace for the data type of ${is_active}. It’ll usually say String if this is the case.