我在 PHP 页面中有这个 JSON 字符串:
{
"elements": [{
"type": "pie",
"alpha": 0.3,
"animate": [{
"type": "fade"
}, {
"type": "bounce",
"distance": 5
}],
"start-angle": 0,
"tip": "#val# de #total# #percent#",
"colours": ["#d01f3c", "#356aa0", "#C79810"],
"values": [{
"value": 1,
"label": "procesador amd sempron 140"
}, {
"value": 1,
"label": "procesador sempron le130"
}, {
"value": 1,
"label": "procesador amd a4-3300 x2"
}, {
"value": 1,
"label": "procesador intel celeron g530"
}]
}],
"title": {
"text": "Procesadores, Reinicio",
"style": "color: #356aa0; font-size: 20px"
},
"bg_colour": "#FFFFFF",
"x_axis": null
}
我这样称呼它:
$.getJSON("restart_proce.php", function(json)
{
console.log(json);
我需要将其转换为:
[{\"value\": 1, \"label\": \"procesador amd sempron 140\" }, { \"value\": 1, \"label\": \"procesador sempron le130\" }, { \"value\": 1, \"label\": \"procesador amd a4-3300 x2\" }, { \"value\": 1, \"label\": \"procesador intel celeron g530\" } ]
我正在尝试删除这样的元素:
delete json.elements[3];
但它不会删除任何东西。我怎样才能让它工作?