{
"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": []
}
To retrieve the value of a JSON object, the field name must be identified through xAxis and yAxis variables as it may vary each time the object is accessed.
When attempting to access jsonData.data[0].data[0].xAxis, it returns undefined instead of the actual value. It's not possible to access like this due to varying field names, so the correct way would be using a variable like jsonData.data[0].data[0].Part .