Within this JSON object snippet, I aim to extract the triggerid of each child object. While I can retrieve the first triggerid using the provided code line,
var gettrigger = eventdata.result[0].relatedObject.triggerid;
I am unsure how to gather the triggerid of every child and store them in an array. Can you provide guidance on achieving this?
var event = {
"jsonrpc":"2.0",
"result":[
{
"eventid":"964101",
"name":"unreachable last 5 minutes",
"severity":"0",
"acknowledged":"0",
"clock":"1578456800",
"hosts":[
{
"hostid":"11195",
"name":"Vi-console"
}
],
"relatedObject":{
"triggerid":"23630"
}
},
{
"eventid":"964091",
"name":"unreachable last 5 minutes",
"severity":"0",
"acknowledged":"0",
"clock":"1578456695",
"hosts":[
{
"hostid":"11180",
"name":"Net-fluid"
}
],
"relatedObject":{
"triggerid":"23375"
}
},
{
"eventid":"964090",
"name":"high cpu usage",
"severity":"3",
"acknowledged":"0",
"clock":"1578456675",
"hosts":[
{
"hostid":"11188",
"name":"Net-OFFICE"
}
],
"relatedObject":{
"triggerid":"23503"
}
}
]
}