My JSON object response includes a `series` array of objects structured like this:
{
series: [
{
name: 'a',
data: [1,2,3]
},
{
name: 'b',
data: [4,5,6]
}
]
}
I am looking to extract the `data` values that correspond to specific `name` values.
Currently, I have achieved this:
$scope.nameArr[i] = response.series[i].name;
While this retrieves the correct `name` array, my attempt to retrieve corresponding data values with the following code fails:
for(var i=0; i<response.series.length; i++) {
$scope.nameArr[i] = response.series[i].name;
for (var j=0; j<response.series[i].data.length; j++){
$scope.dataArr[j] = response.series[i].data[j];
}
}