Getting a silent failure on an ASSIGN action in Studio. The variable ends up empty instead of throwing a validation error, which makes debugging this a pain.
I’m trying to extract a specific field from a JSON payload received via a REST call. The payload structure is straightforward:
{
"data": {
"customer": {
"id": 12345,
"tier": "gold"
}
}
}
I have the response stored in $rest_response. I want to grab the tier. Here is the configuration for the ASSIGN action:
Assign Variable: $customer_tier
Value Type: Expression
Expression: $rest_response.data.customer.tier
It returns null. I’ve tried using the JSONPath syntax $rest_response.data['customer']['tier'] but that throws a syntax error in the Studio editor. The documentation says ASSIGN supports dot notation for nested objects, but it seems to break if the intermediate object doesn’t exist or if there’s a type mismatch.
I added a DEBUG action right before it, and $rest_response looks correct. It’s a string though. Do I need to explicitly cast it to an object first? Or is there a specific function I’m missing to parse the string into a traversable object before the ASSIGN happens?
Tried wrapping it in json.parse($rest_response) but Studio doesn’t recognize that function in the expression builder.