我需要删除json中的第一个索引
JSON:
{"data":[{"label":"Data","data":1},{"label":"Website","data":1}]}
我需要:
[{"label":"Data","data":1},{"label":"Website","data":1}]
object{}
JS代码:
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
});
});
}
有谁能告诉我哪里做错了?任何建议都是最受欢迎的。
答案 0 :(得分:1)
var data = {"data":[{"label":"Data","data":1},{"label":"Website","data":1}]};
data = data.data
这是你要找的吗?