- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 12:48 AM
Hi All,
Unable to parse the JSON data which i am getting like as below: i want to map the highlighted ones. Please advice.
{
"Incident" : {
"properties(description)" : {
"value" : "Service Account, Logic Monitor made an attempt to run commands remotely on ******S002 from *****789, using 1 PowerShell command. "
},
"properties(owner(userPrincipalName))" : {
"value" : "example 123"
},
"properties(title)" : {
"value" : "Remote code execution attempt"
},
},
"HostEntity" : {
"properties(hostName)" : {
"value" : "8888S002, 9999S001"
},
"properties(additionalData(ShouldResolveIp))" : {
"value" : "False, False, False, False, False"
}
},
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 02:34 AM
Try this code below
var str = {
"Incident":{
"properties(description)":{
"value":"Service Account, Logic Monitor made an attempt to run commands remotely on ******S002 from *****789, using 1 PowerShell command. "
},
"properties(owner(userPrincipalName))":{
"value":"example 123"
},
"properties(title)":{
"value":"Remote code execution attempt"
}
},
"HostEntity":{
"properties(hostName)":{
"value":"8888S002, 9999S001"
},
"properties(additionalData(ShouldResolveIp))":{
"value":"False, False, False, False, False"
}
}
};
var str2 = str.Incident;
gs.print(JSON.stringify(str2["properties(description)"].value));//-- -- -- -- -- -- - > printing the value as Undefined
Thanks & Regards,
Vasanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 12:56 AM
What have you done already to attempt to parse the provided JSON payload? Is this using Flow Designer and a parse JSON action or are you using a script? If the latter, can you provide your existing logic so any member of the community that responds doesn't duplicate on a solution you've already tried.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 02:23 AM
I have storing the string data in variable str.
var str =
{"Incident" : {"properties(description)" : {"value" : "Service Account, Logic Monitor made an attempt to run commands remotely on ******S002 from *****789, using 1 PowerShell command. "
},
"properties(owner(userPrincipalName))" : {
"value" : "example 123"
},
"properties(title)" : {
"value" : "Remote code execution attempt"
},
},
"HostEntity" : {
"properties(hostName)" : {
"value" : "8888S002, 9999S001"
},
"properties(additionalData(ShouldResolveIp))" : {
"value" : "False, False, False, False, False"
}
},
var obj =JSON.parse(str);
gs.print(JSON.stringify(obj.Incident));
var str2 = obj.Incident;
gs.print(JSON.stringify(str2.properties(description))); ------------->printing the value as Undefined
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 02:27 AM
End the str with a semi colon and try
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 02:34 AM
Try this code below
var str = {
"Incident":{
"properties(description)":{
"value":"Service Account, Logic Monitor made an attempt to run commands remotely on ******S002 from *****789, using 1 PowerShell command. "
},
"properties(owner(userPrincipalName))":{
"value":"example 123"
},
"properties(title)":{
"value":"Remote code execution attempt"
}
},
"HostEntity":{
"properties(hostName)":{
"value":"8888S002, 9999S001"
},
"properties(additionalData(ShouldResolveIp))":{
"value":"False, False, False, False, False"
}
}
};
var str2 = str.Incident;
gs.print(JSON.stringify(str2["properties(description)"].value));//-- -- -- -- -- -- - > printing the value as Undefined
Thanks & Regards,
Vasanth