CXone Studio Snippet: IF action failing to parse boolean from REST proxy response

I am hitting a weird issue with the IF action in a CXone Studio snippet. The goal is to branch logic based on whether a customer exists in our external CRM. I’m using the GetRESTProxy to call our internal API endpoint. The response comes back as a 200 OK with a JSON body like {"exists": true, "id": 12345}.

I assign the response to a variable called crmResult using an ASSIGN action. Then I try to use an IF action to check if crmResult.exists is true. Here is the code structure I am using:

// Get REST Proxy response
ASSIGN crmResult = GetRESTProxy("crmCheck", "GET", "/api/customers/{{customer.id}}")

// Check if customer exists
IF (crmResult.exists == true) THEN
 GOTO "UpdateCustomer"
ELSE
 GOTO "CreateCustomer"
END IF

The problem is that the IF condition always evaluates to false, even when the JSON clearly shows exists: true. I’ve checked the logs and crmResult.exists is being read as a string "true" instead of a boolean. If I change the condition to crmResult.exists == "true", it works, but that feels fragile. What if the API returns true without quotes in some edge case?

I tried casting it using BOOL(crmResult.exists) but the snippet editor throws a syntax error saying BOOL is not a recognized function. Is there a way to force type conversion in Studio snippets? Or should I just stick to string comparison? I don’t want to break the logic if the API team changes the response format later.

Also, I noticed that if the API returns null for exists, the IF action doesn’t throw an error but just skips the block. That’s fine, but it’s confusing to debug. I’ve spent the last hour staring at this and I’m probably missing something obvious. Any ideas on how to handle this type coercion properly in Studio?