I have an json array like this
var data= [
{
"id": 24,
"title": "BCOM",
"start": "2014-08-05 12:59:00 PM",
"end": "2014-08-05 2:59:00 PM",
"description": "mcom",
"DIFF": 120
},
{
"id": 26,
"title": "MCOM",
"start": "2014-08-10 12:59:00 PM",
"end": "2014-08-10 4:59:00 PM",
"description": "mcom",
"DIFF": 240
},
{
"id": 29,
"title": "MCOM",
"start": "2014-08-11 12:59:00 PM",
"end": "2014-08-11 8:59:00 PM",
"description": "mcom",
"DIFF": 480
},
{
"id": 30,
"title": "MCOM",
"start": "2014-08-13 12:59:00 PM",
"end": "2014-08-13 4:59:00 PM",
"description": "mcom",
"DIFF": 240
}
]
I want to make this array having index with out double quotes and change some index names , and some other modifications by using javascript array functions.
like
var data = [
{
id: 24,
title:"MCOM",
y: 120
},
{
id: 26,
title:"MCOM",
y: 240,
},
{
id: 29,
title:"MCOM",
y: 480,
},
]
Please help me in this, Thank you
ywith the value ofDIFFanddeleteother attributes ! You can useArray.prototype.forEach()and code a callback function to do your modifications.BCOMisn't it?