I have a json that looks like this:
"metrics" : {
"ga:pageviews" : true,
"bounceRate" : false
}
which is sub object of a bigger json. I access that object like this:
var metrics = report.specifications[0]
I am trying to iterate through these two properties like this:
for(var key in metrics) {
if (metrics.hasOwnProperty(key)) {
console.log(key + " -> " + metrics[key]);
}
}
Although, instead of getting these two properties i get a very big list with other properties of the object.
The first line of the unlimited list i get is:
__parentArray -> { metrics: { 'ga:pageviews': true, bounceRate: false } }
Does this has to do with my issue?
Whole JSON schema looks like this:
reportId: String,
specifications : [{
metrics: {
'ga:pageviews': Boolean,
bounceRate: Boolean
},
dimensions: {
}
}
]
}
Any ideas?