I have following json
[{\"Country\":\"Europe\",\"City\":[\"Berlin\",\"Istanbul\",\"London\",\"Manchester\",\"Milan\",\"Paris\"]},null]
I want to read the country and its cities.
I have tried it like this
var eu = jQuery.parseJSON($("#EU").val());
for( i=0; i<eu.length();i++)
{
alert( eu[0][0]);
}
But I am getting undefined error in alert.
How can I accomplish the above task?
alert( eu[0][0]);anyway as you might want to includeisomewhere here...eu[0]is object and you can call[0]for it. It should beeu[0]["Country"]oreu[0]["City"]. I think you wanteu[0]["City"][0]$("#EU").val()andjQuery.parseJSON($("#EU").val())are returning?