I'm trying to grab certain bits of data out of my JSON response to put in an array. This is my JSON response, and what I am interested in is the "counts" which is hourly, separated by either page "statement" or "logon".
{
"report":{
"type":"trended",
"elements":[
{
"id":"page",
"name":"Page"
}
],
"reportSuite":{
"id":"retail",
"name":"GlobPROD"
},
"period":"Wed. 3 Oct. 2018 - Fri. 5 Oct. 2018",
"metrics":[
{
"id":"pageviews"
}
],
"segments":[
{
"id":"s13bb443734ab6a764639ff37",
"name":"Information"
}
],
"data":[
{
"name":"Wed. 3 Oct. 2018",
"year":2018,
"month":10,
"day":3,
"hour":0,
"breakdown":[
{
"name":"CATEGORY:>Statement",
"url":"",
"counts":[
"242"
]
},
{
"name":"CATEGORY:>Log On",
"url":"...CheckId.do",
"counts":[
"237"
]
}
],
"breakdownTotal":[
"2123"
]
},
{
"name":"Wed. 3 Oct. 2018 (Hour 1)",
"year":2018,
"month":10,
"day":3,
"hour":1,
"breakdown":[
{
"name":"CATEGORY:>Statement",
"url":"",
"counts":[
"152"
]
},
{
"name":"CATEGORY:>Log On",
"url":"",
"counts":[
"135"
]
}
],
"breakdownTotal":[
"1140"
]
}
So what I am after is firstly to be able to split out the hourly data between statement and login, and secondly build an array of the data hour by hour.
logindata: [237, 135]
statementdata: [242, 152]
I've read that I can try and grab values using something a bit like this:
var t = JSON.parse('{"name": "", "skills": "", "jobtitel": "Entwickler", "res_linkedin": "GwebSearch"}');
But how can I create a little loop to grab all the values I specify like in my example?
137?