私はこのような配列を持っています
[{
"Inventory": {
"dashboard_id": "Inventory",
"filter_by": "Location",
"yAxis": "Quantity",
"title": "",
"chart_type": "-------Select-------",
"mainchart": "Yes"
},
"Quality": {
"dashboard_id": "Quality",
"filter_by": "Location",
"yAxis": "SampleNo",
"title": "",
"chart_type": "-------Select-------",
"mainchart": "Yes"
}
}]
各オブジェクトにさらに値を追加する必要があります。このように見えるように、既存の配列に追加するにはどうすればよいですか
{
"Inventory": [{
"dashboard_id": "Inventory",
"filter_by": "Location",
"yAxis": "Quantity",
"title": "",
"chart_type": "-------Select-------",
"mainchart": "Yes"
}, {
"dashboard_id": "Inventory",
"filter_by": "Location",
"yAxis": "Quantity",
"title": "",
"chart_type": "-------Select-------",
"mainchart": "Yes"
}],
"Quality": {
"dashboard_id": "Quality",
"filter_by": "Location",
"yAxis": "SampleNo",
"title": "",
"chart_type": "-------Select-------",
"mainchart": "Yes"
}
}
を使用して配列に追加しますnestedData[dashId] = data;
dashId はQuality
、「Inventory」などで構成されます。
データは
{
"dashboard_id": "Inventory",
"filter_by": "Location",
"yAxis": "Quantity",
"title": "",
"chart_type": "-------Select-------",
"mainchart": "Yes"
}