Hey folks,
Running into a wall with Studio scripting again. We’re trying to hit an internal endpoint to fetch customer tier info and update a flow variable based on the response. The REST call itself works fine-I can see the 200 OK in the debug logs. But I’m completely stuck on how to actually grab the data out of the JSON response in the ASSIGN action.
Here’s the setup:
- GetRESTProxy: Method POST, URL
https://internal.api/customer/tier. Body is just{"id": "{{var.customerId}}"}. Header has the auth token. Response is stored invar.tierResponse. - ASSIGN Action: I’m trying to set
var.customerTierto the value from the response.
The JSON response looks like this:
{
"status": "success",
"data": {
"tier": "platinum",
"score": 950
}
}
I’ve tried a bunch of syntax variations in the ASSIGN expression field:
{{var.tierResponse.data.tier}}{{var.tierResponse.json.data.tier}}{{var.tierResponse.body.data.tier}}
None of them work. The variable just ends up empty or throws a null reference error when the flow tries to branch on it. I know GetRESTProxy returns a wrapper object, but the documentation is super vague on the exact property names. Is it content? payload? result?
I also tried logging var.tierResponse to the debug console, but it just prints [object Object], which isn’t helpful at all. I can’t seem to drill down into the nested data object.
Has anyone successfully parsed a nested JSON response from a custom REST call in Studio? I’m feeling like I’m missing a really obvious step here. Don’t want to resort to writing a custom snippet just to parse JSON if I don’t have to.
Thanks.