- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 08:08 PM - edited 03-01-2025 12:05 AM
Hello,
Can anyone please help? In Flow Designer, when I called API, I got Response Body as below data. It's Array Object type. I would like to get the "value" of emails data (test@abc.com). in String. Which script can help?
"emails":[
{"value":"test@abc.com",
"type":"work",
"primary":true}
],
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 09:37 PM
@Bird1 - I assume the response is JSON and the below script will parse the object and set the value (key) to the variable email which you can set it to output variable of your flow action.
var responseContent = {
"emails": [{
"value": "test@abc.com",
"type": "work",
"primary": true
}]
};
var email = responseContent.emails[0].value
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 09:36 PM
Hi @Bird1, if there is only one child inside the object you can store the value in a flow variable and then use it -
var email = fd_data.subflow_inputs.emails[0].email.toString();
gs.log("Email = "+email);
fd_data.flow_var.email = email;
I utilized a subflow to replicate your requirement.
If there will be more than one child, then call a for each inside the flow, then pass the value:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2025 04:46 AM
@GopikaP - Thank you very much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2025 09:37 PM
@Bird1 - I assume the response is JSON and the below script will parse the object and set the value (key) to the variable email which you can set it to output variable of your flow action.
var responseContent = {
"emails": [{
"value": "test@abc.com",
"type": "work",
"primary": true
}]
};
var email = responseContent.emails[0].value
Thanks & Regards,
Vasanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2025 04:46 AM
@Vasantharajan N - Thank you very much!