How can I access the array within an array which is a json. "
[
{"series":[
{"name":"Financial","data":[0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0]},
{"name":"Burial","data":[1,0,1,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0]},
{"name":"Medical","data":[0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
]
}
]
what i want to access is the array of "series" which is
[
{"name":"Financial","data":[0,0,3,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0]},
{"name":"Burial","data":[1,0,1,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,0,0]},
{"name":"Medical","data":[0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
]
How can I so that in jquery? This is my code
series1 = JSON.stringify(data[0]);
alert(series1);
what i've got above is the curly brace started from the "series" upto the last curly brace. Thanks in advance.
asked May 26, 2014 at 4:45
akoDwin
1392 gold badges2 silver badges14 bronze badges
1 Answer 1
both of these will work :
data[0].series
or
data[0]['series']
and for inside the series :
data[0].series[0].name
data[0].series[1].name
answered May 26, 2014 at 4:49
Exlord
5,4395 gold badges39 silver badges58 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default