So I have
var arrays = [
[ Material A, 1, 2, 3, 4, 5 ],
[ Material B, 6, 7, 8, 9, 10 ],
[ Material C, 11, 12, 13, 14, 15 ]
];
and I need to put it in this format which is a multidimensional associative array,
var bigdata = [
{ "Name": "MaterialA", "Row1": 1, "Row2": 2, "Row3": 3, "Row4": 4, "Row5": 5 },
{ "Name": "MaterialB", "Row1": 6, "Row2": 7, "Row3": 8, "Row4": 9, "Row5": 10 },
{ "Name": "MaterialC", "Row1": 11, "Row2": 12, "Row3": 13, "Row4": 14, "Row5": 15 }
];
I am trying
var bigdata = new Array(3);
for (i=0; i<3; i++)
{
// do name
bigdata[i][0] = {"Name" : arrays[i][0]};
for (j=1; j<6; j++ )
{
// rest of that row
}
}
But so far it is not working when I try to store the first "Name": "MaterialA" . What am I doing wrong or can this even be done? Thanks for the help.