Looping through JSON

Looping through JSON

I get a list of countries and in a country there is a list of city. I am trying to loop through countries and cities.
I am trying to do following:

                        $.each(d, function (i, country) {
                            $.each(country.Cities, function (z, city) {
                                 alert(city.Name);
                            });
                        });

but it is not working. What is wrong in my double loop please? It is only giving me the first city name, and not looping through the rest of the countries.

I found my mistake. I had used a wrong variable - >alert(item.Name); should be alert(city.Name);