how to parse in JSON


(Amit Singh Nayal) #1

I want to take the value of FamilyImportStatus but when I am printing it its giving me a blank space.
JSON.stringify(context.Service_Feed_status.response.body.familyBeanss.familyBeans.MailStatus) ;

{
“statusCode”: 200,
“body”: {
“familyBeanss”: {
“familyBeans”: [
{
“FamilyImportStatus”: [
“Family Not Present in the Import”
],
“MailStatus”: [
“Mail Sent to the STEP team”
]
}
]


(Yoga Ramya Mendu) #2

Hi @amit.singh.nayal,

We have tested the scenario with the same JSON structure. Please follow the below steps:
1- Added the above JSON in a script node.

context.JsonScript=[
{
“statusCode”: 200,
“body”: {
“familyBeanss”: {
“familyBeans”: [
{
“FamilyImportStatus”: [
“Family Not Present in the Import”
],
“MailStatus”: [
“Mail Sent to the STEP team”
]
}
]
}
}
}
];

script1 script2

2- In the message node, to print the Mail status from the above JSON, please use the following javascript prompt message

print(context.JsonScript[0].body.familyBeanss.familyBeans[0].MailStatus[0])

script3

Let us know if you need any further clarification.

Regards,
Yoga Ramya.