Accessing a field of json data
I am getting below json data in jsondata field:
HTML Code:
{
"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
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 899308
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 1597379
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 0
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 0
},
{
"Part": "other",
"ProductionCounts": 2196254
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 652255
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 118862
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 314481
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 0
},
{
"Part": "other",
"ProductionCounts": 2106794
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 799850
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 787854
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 572825
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 586796
},
{
"Part": "other",
"ProductionCounts": 1699898
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 1098905
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 849032
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 680223
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 676436
},
{
"Part": "other",
"ProductionCounts": 2126999
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 1182160
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 1096124
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 307723
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 0
},
{
"Part": "other",
"ProductionCounts": 2339177
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 442606
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 1188054
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 232819
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 437088
},
{
"Part": "other",
"ProductionCounts": 2123290
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 804017
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 701323
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 658470
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 400048
},
{
"Part": "other",
"ProductionCounts": 1453187
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 1976932
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 179347
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 493326
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 366893
},
{
"Part": "other",
"ProductionCounts": 1537608
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 1220153
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 651824
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 543190
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 0
},
{
"Part": "other",
"ProductionCounts": 3195743
}]
},
{
"data": [{
"Part": "1.75 L ICON (Glass)",
"ProductionCounts": 0
},
{
"Part": "1.75 L Marg Mix (PET)",
"ProductionCounts": 0
},
{
"Part": "1.75 L Authentics (PET)",
"ProductionCounts": 0
},
{
"Part": "1.0 L Margarita Mix / PET",
"ProductionCounts": 0
},
{
"Part": "other",
"ProductionCounts": 0
}]
}],
"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": []
}
I am getting the xAxis value in one variable like
var xAxis = jsonData.xAxis;
Value is coming fine in variable but when I am trying to access value like this.
jsonData.data[0].data[0].xAxis -- > it is giving me undefined instead of correct value.
What I am doing wrong here? What should be the correct method to access that value ?