I have a JSON response that looks like this
[
{
"alias": "Server1",
"hostgroup_worst_service_state": "0",
"status_history": {
"status": [
"0",
"2",
"0",
"0"
]
}
},
{
"alias": "Server2",
"hostgroup_worst_service_state": "0",
"status_history": {
"status": [
"0",
"0",
"0",
"0"
]
}
},
{
"alias": "Server3",
"hostgroup_worst_service_state": "0",
"status_history": {
"status": [
"1",
"1",
"1",
"0"
]
}
}
]
I can easily access the alias and hostgroup_worst_state using the .each iterator function:
$.each(data, function(i, item) {
console.log(item.alias)
console.log(item.hostgroup_worst_service_state)
}
However I struggle to have access to the status data. I would need to display them this way:
["0","2","0","0"]
["0","0","0","0"]
["1","1","1","1"]
These value will next be used to display graphs using jQuery Sparklines.
Thanks for your help,
item.status_history.statusnot give you an array?