{
"data": [{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 1012620
}, {
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 1003278
}, {
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 457615
}, {
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 660982
}, {
"Part": "other",
"ProductionCounts": 1571985
}]
}, ],
"dateArray": ["2011-01-01", "2011-02-01", "2011-03-01", "2011-04-01", "2011-05-01", "2011-06-01", "2011-07-01", "2011-08-01", "2011-09-01", "2011-10-01", "2011-11-01"],
"xAxis": "Part",
"yAxis": "ProductionCounts",
"interestingMoments": []
}
我想访问 json 对象的值。每次获取 json 对象时,json 对象的字段名称都会不同,因此我将 xAxis 和 yAxis 中的字段名称分开发送。
当我尝试访问 jsonData.data[0].data[0].xAxis 时,它给了我 undefined 而不是 value。我不能像这样访问,因为字段名称每次都会不同,所以我试图通过变量 jsonData.data[0].data[0].Part 访问它。