How can I remove the first index in a JSON object?
JSON:
{"data":[{"label":"Data","data":1},{"label":"Website","data":1}]}
I need:
[{"label":"Data","data":1},{"label":"Website","data":1}]
- When I try to delete .data, it outputs
object{}
JavaScript code:
function drawChart() {
$.getJSON("data.json", function (json) {
// callback function which gets called when your request completes.
var myJsonString = JSON.stringify(json);
console.log(myJsonString);
Morris.Donut({
element: 'donut-example',
data: myJsonString // use returned data to plot the graph
});
});
}
Can anyone point out where I went wrong? Any suggestions are greatly appreciated.