Possible Duplicate:
Parsing JSON with JavaScript
I understand to get the value of a json data, for instance var json = [{"country":"US"}], I can do it like json[0].country.
I've this json data [{"0":"US"}], so how do I retrieve the data then?
Possible Duplicate:
Parsing JSON with JavaScript
I understand to get the value of a json data, for instance var json = [{"country":"US"}], I can do it like json[0].country.
I've this json data [{"0":"US"}], so how do I retrieve the data then?
var myvar = { mykey: myvalue }you can domyvar[mykey]. You can event execute functionsvar myvar = { mykey: function(){...} }withmyvar[mykey]().myvar["mykey"].