I am trying to convert a json object that contains:
to this format:
but am not sure how to go about parsing the object and making the necessary changes.
Code:
var dataold = [{
"DateGroup": "05/15/2012",
"Product": "Var1",
"Duration": 0
},{
"DateGroup": "05/15/2012",
"Product": "Var2",
"Duration": 53.999700
},{
"DateGroup": "05/15/2012",
"Product": "Var3",
"Duration": 86.999580
}
];
to this format:
Code:
var datanew = [{
"DateGroup": "05/15/2012",
"var1": 0,
"var2": 53.999700,
"var3": 86.999580
},{
"DateGroup": "06/17/2012",
"var1": 32.999880,
"var2": 59.999700,
"var2": 59.999700
},{
"DateGroup": "07/19/2012",
"var1": 37.999880,
"var2": 0,
"var3": 83.999580
}
];
but am not sure how to go about parsing the object and making the necessary changes.