Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

So I have this JSON array:

$countryCodes = json_decode("{
    "Codes": [
        {"Code":"AD","Country":"Andorra"},
        {"Code":"AE","Country":"United Arab Emirates (الإمارات العربيّة المتّحدة)"},
        {"Code":"AF","Country":"Afghanistan (افغانستان)"},
        {"Code":"AG","Country":"Antigua and Barbuda"},
        {"Code":"AI","Country":"Anguilla"},
        {"Code":"AL","Country":"Albania (Shqipëria)"},
        {"Code":"AM","Country":"Armenia (Հայաստան)"},
        {"Code":"AO","Country":"Angola"},
        {"Code":"AQ","Country":"Antarctica"},
        {"Code":"AR","Country":"Argentina"},
        {"Code":"AS","Country":"American Samoa"},
        {"Code":"AT","Country":"Austria (Österreich)"},
        {"Code":"AU","Country":"Australia"},
        {"Code":"AW","Country":"Aruba"},
        {"Code":"AX","Country":"Aland Islands"},
        {"Code":"AZ","Country":"Azerbaijan (Azərbaycan)"},
        {"Code":"BA","Country":"Bosnia and Herzegovina (Bosna i Hercegovina)"},
        {"Code":"BB","Country":"Barbados"},
        {"Code":"BD","Country":"Bangladesh (বাংলাদেশ)"},
        {"Code":"BE","Country":"Belgium (België)"},
        {"Code":"BF","Country":"Burkina Faso"},
        {"Code":"BG","Country":"Bulgaria (България)"},
        {"Code":"BH","Country":"Bahrain (البحرين)"},
        {"Code":"BI","Country":"Burundi (Uburundi)"},
        {"Code":"BJ","Country":"Benin (Bénin)"},
        {"Code":"BL","Country":"Saint Barthélemy"},
        {"Code":"BM","Country":"Bermuda"},
        {"Code":"BN","Country":"Brunei (Brunei Darussalam)"},
        {"Code":"BO","Country":"Bolivia, Plurinational State of"},
        {"Code":"BQ","Country":"Bonaire, Sint Eustatius and Saba"},
        {"Code":"BR","Country":"Brazil (Brasil)"},
        {"Code":"BS","Country":"Bahamas"},
        {"Code":"BT","Country":"Bhutan (འབྲུག་ཡུལ)"},
        {"Code":"BV","Country":"Bouvet Island"},
        {"Code":"BW","Country":"Botswana"},
        {"Code":"BY","Country":"Belarus (Белару́сь)"},
        {"Code":"BZ","Country":"Belize"},
        {"Code":"CA","Country":"Canada"},
        {"Code":"CC","Country":"Cocos (Keeling) Islands"},
        {"Code":"CD","Country":"Congo, Democratic Republic of the"},
        {"Code":"CF","Country":"Central African Republic (République Centrafricaine)"},
        {"Code":"CG","Country":"Congo"},
        {"Code":"CH","Country":"Switzerland (Schweiz)"},
        {"Code":"CI","Country":"Côte d'Ivoire"},
        {"Code":"CK","Country":"Cook Islands"},
        {"Code":"CL","Country":"Chile"},
        {"Code":"CM","Country":"Cameroon (Cameroun)"},
        {"Code":"CN","Country":"China (中国)"},
        {"Code":"CO","Country":"Colombia"},
        {"Code":"CR","Country":"Costa Rica"},
        {"Code":"CU","Country":"Cuba"},
        {"Code":"CV","Country":"Cape Verde (Cabo Verde)"},
        {"Code":"CW","Country":"Curaçao"},
        {"Code":"CX","Country":"Christmas Island"},
        {"Code":"CY","Country":"Cyprus (Κυπρος)"},
        {"Code":"CZ","Country":"Czech Republic (Česko)"},
        {"Code":"DE","Country":"Germany (Deutschland)"},
        {"Code":"DJ","Country":"Djibouti"},
        {"Code":"DK","Country":"Denmark (Danmark)"},
        {"Code":"DM","Country":"Dominica"},
        {"Code":"DO","Country":"Dominican Republic"},
        {"Code":"DZ","Country":"Algeria (الجزائر)"},
        {"Code":"EC","Country":"Ecuador"},
        {"Code":"EE","Country":"Estonia (Eesti)"},
        {"Code":"EG","Country":"Egypt (مصر)"},
        {"Code":"EH","Country":"Western Sahara (الصحراء الغربية)"},
        {"Code":"ER","Country":"Eritrea (Ertra)"},
        {"Code":"ES","Country":"Spain (España)"},
        {"Code":"ET","Country":"Ethiopia (Ityop'iya)"},
        {"Code":"FI","Country":"Finland (Suomi)"},
        {"Code":"FJ","Country":"Fiji"},
        {"Code":"FK","Country":"Falkland Islands"},
        {"Code":"FM","Country":"Micronesia"},
        {"Code":"FO","Country":"Faroe Islands"},
        {"Code":"FR","Country":"France"},
        {"Code":"GA","Country":"Gabon"},
        {"Code":"GB","Country":"United Kingdom"},
        {"Code":"GD","Country":"Grenada"},
        {"Code":"GE","Country":"Georgia (საქართველო)"},
        {"Code":"GF","Country":"French Guiana"},
        {"Code":"GG","Country":"Guernsey"},
        {"Code":"GH","Country":"Ghana"},
        {"Code":"GI","Country":"Gibraltar"},
        {"Code":"GL","Country":"Greenland"},
        {"Code":"GM","Country":"Gambia"},
        {"Code":"GN","Country":"Guinea (Guinée)"},
        {"Code":"GP","Country":"Guadeloupe"},
        {"Code":"GQ","Country":"Equatorial Guinea (Guinea Ecuatorial)"},
        {"Code":"GR","Country":"Greece (Ελλάς)"},
        {"Code":"GS","Country":"South Georgia and the South Sandwich Islands"},
        {"Code":"GT","Country":"Guatemala"},
        {"Code":"GU","Country":"Guam"},
        {"Code":"GW","Country":"Guinea-Bissau (Guiné-Bissau)"},
        {"Code":"GY","Country":"Guyana"},
        {"Code":"HK","Country":"Hong Kong"},
        {"Code":"HM","Country":"Heard Island and McDonald Islands"},
        {"Code":"HN","Country":"Honduras"},
        {"Code":"HR","Country":"Croatia (Hrvatska)"},
        {"Code":"HT","Country":"Haiti (Haïti)"},
        {"Code":"HU","Country":"Hungary (Magyarország)"},
        {"Code":"ID","Country":"Indonesia"},
        {"Code":"IE","Country":"Ireland"},
        {"Code":"IL","Country":"Israel (ישראל)"},
        {"Code":"IM","Country":"Isle of Man"},
        {"Code":"IN","Country":"India"},
        {"Code":"IO","Country":"British Indian Ocean Territory"},
        {"Code":"IQ","Country":"Iraq (العراق)"},
        {"Code":"IR","Country":"Iran, Islamic Republic of (جمهوری اسلامی ایران)"},
        {"Code":"IS","Country":"Iceland (Ísland)"},
        {"Code":"IT","Country":"Italy (Italia)"},
        {"Code":"JE","Country":"Jersey"},
        {"Code":"JM","Country":"Jamaica"},
        {"Code":"JO","Country":"Jordan (الاردن)"},
        {"Code":"JP","Country":"Japan (日本)"},
        {"Code":"KE","Country":"Kenya"},
        {"Code":"KG","Country":"Kyrgyzstan (Кыргызстан)"},
        {"Code":"KH","Country":"Cambodia (Kampuchea)"},
        {"Code":"KI","Country":"Kiribati"},
        {"Code":"KM","Country":"Comoros (Comores)"},
        {"Code":"KN","Country":"Saint Kitts and Nevis"},
        {"Code":"KP","Country":"Korea, (North) Democratic People’s Republic of (조선민주주의인민공화국)"},
        {"Code":"KR","Country":"Korea, (South) Republic of (대한민국)"},
        {"Code":"KW","Country":"Kuwait (الكويت)"},
        {"Code":"KY","Country":"Cayman Islands"},
        {"Code":"KZ","Country":"Kazakhstan (Қазақстан)"},
        {"Code":"LA","Country":"Lao People’s Democratic Republic (ສາທາລະນະລັດ ປະຊາທິປະໄຕ ປະຊາຊົນລາວ)"},
        {"Code":"LB","Country":"Lebanon (لبنان)"},
        {"Code":"LC","Country":"Saint Lucia"},
        {"Code":"LI","Country":"Liechtenstein"},
        {"Code":"LK","Country":"Sri Lanka"},
        {"Code":"LR","Country":"Liberia"},
        {"Code":"LS","Country":"Lesotho"},
        {"Code":"LT","Country":"Lithuania (Lietuva)"},
        {"Code":"LU","Country":"Luxembourg (Lëtzebuerg)"},
        {"Code":"LV","Country":"Latvia (Latvija)"},
        {"Code":"LY","Country":"Libya (ليبيا)"},
        {"Code":"MA","Country":"Morocco (المغرب)"},
        {"Code":"MC","Country":"Monaco"},
        {"Code":"MD","Country":"Moldova, Republic of"},
        {"Code":"ME","Country":"Montenegro (Црна Гора)"},
        {"Code":"MF","Country":"Saint Martin (French part)"},
        {"Code":"MG","Country":"Madagascar (Madagasikara)"},
        {"Code":"MH","Country":"Marshall Islands"},
        {"Code":"MK","Country":"Macedonia, the former Yugoslav Republic of (Македонија)"},
        {"Code":"ML","Country":"Mali"},
        {"Code":"MM","Country":"Myanmar (Burma)"},
        {"Code":"MN","Country":"Mongolia (Монгол Улс)"},
        {"Code":"MO","Country":"Macao"},
        {"Code":"MP","Country":"Northern Mariana Islands"},
        {"Code":"MQ","Country":"Martinique"},
        {"Code":"MR","Country":"Mauritania (موريتانيا)"},
        {"Code":"MS","Country":"Montserrat"},
        {"Code":"MT","Country":"Malta"},
        {"Code":"MU","Country":"Mauritius"},
        {"Code":"MV","Country":"Maldives"},
        {"Code":"MW","Country":"Malawi"},
        {"Code":"MX","Country":"Mexico (México)"},
        {"Code":"MY","Country":"Malaysia"},
        {"Code":"MZ","Country":"Mozambique (Moçambique)"},
        {"Code":"NA","Country":"Namibia"},
        {"Code":"NC","Country":"New Caledonia"},
        {"Code":"NE","Country":"Niger"},
        {"Code":"NF","Country":"Norfolk Island"},
        {"Code":"NG","Country":"Nigeria"},
        {"Code":"NI","Country":"Nicaragua"},
        {"Code":"NL","Country":"Netherlands (Nederland)"},
        {"Code":"NO","Country":"Norway (Norge)"},
        {"Code":"NP","Country":"Nepal (नेपाल)"},
        {"Code":"NR","Country":"Nauru (Naoero)"},
        {"Code":"NU","Country":"Niue"},
        {"Code":"NZ","Country":"New Zealand"},
        {"Code":"OM","Country":"Oman (عمان)"},
        {"Code":"PA","Country":"Panama (Panamá)"},
        {"Code":"PE","Country":"Peru (Perú)"},
        {"Code":"PF","Country":"French Polynesia"},
        {"Code":"PG","Country":"Papua New Guinea"},
        {"Code":"PH","Country":"Philippines (Pilipinas)"},
        {"Code":"PK","Country":"Pakistan (پاکستان)"},
        {"Code":"PL","Country":"Poland (Polska)"},
        {"Code":"PM","Country":"Saint Pierre and Miquelon"},
        {"Code":"PN","Country":"Pitcairn"},
        {"Code":"PR","Country":"Puerto Rico"},
        {"Code":"PS","Country":"Palestine, State of"},
        {"Code":"PT","Country":"Portugal"},
        {"Code":"PW","Country":"Palau (Belau)"},
        {"Code":"PY","Country":"Paraguay"},
        {"Code":"QA","Country":"Qatar (قطر)"},
        {"Code":"RE","Country":"Réunion"},
        {"Code":"RO","Country":"Romania (România)"},
        {"Code":"RS","Country":"Serbia (Србија)"},
        {"Code":"RU","Country":"Russian Federation (Россия)"},
        {"Code":"RW","Country":"Rwanda"},
        {"Code":"SA","Country":"Saudi Arabia (المملكة العربية السعودية)"},
        {"Code":"SB","Country":"Solomon Islands"},
        {"Code":"SC","Country":"Seychelles"},
        {"Code":"SD","Country":"Sudan (السودان)"},
        {"Code":"SE","Country":"Sweden (Sverige)"},
        {"Code":"SG","Country":"Singapore (Singapura)"},
        {"Code":"SH","Country":"Saint Helena, Ascension and Tristan da Cunha"},
        {"Code":"SI","Country":"Slovenia (Slovenija)"},
        {"Code":"SJ","Country":"Svalbard and Jan Mayen"},
        {"Code":"SK","Country":"Slovakia (Slovensko)"},
        {"Code":"SL","Country":"Sierra Leone"},
        {"Code":"SM","Country":"San Marino"},
        {"Code":"SN","Country":"Senegal (Sénégal)"},
        {"Code":"SO","Country":"Somalia (Soomaaliya)"},
        {"Code":"SR","Country":"Suriname"},
        {"Code":"SS","Country":"South Sudan"},
        {"Code":"ST","Country":"São Tomé and Príncipe"},
        {"Code":"SV","Country":"El Salvador"},
        {"Code":"SX","Country":"Sint Maarten (Dutch part)"},
        {"Code":"SY","Country":"Syrian Arab Republic (سوريا)"},
        {"Code":"SZ","Country":"Swaziland"},
        {"Code":"TC","Country":"Turks and Caicos Islands"},
        {"Code":"TD","Country":"Chad (Tchad)"},
        {"Code":"TF","Country":"French Southern Territories"},
        {"Code":"TG","Country":"Togo"},
        {"Code":"TH","Country":"Thailand (ราชอาณาจักรไทย)"},
        {"Code":"TJ","Country":"Tajikistan (Тоҷикистон)"},
        {"Code":"TK","Country":"Tokelau"},
        {"Code":"TL","Country":"Timor-Leste"},
        {"Code":"TM","Country":"Turkmenistan (Türkmenistan)"},
        {"Code":"TN","Country":"Tunisia (تونس)"},
        {"Code":"TO","Country":"Tonga"},
        {"Code":"TR","Country":"Turkey (Türkiye)"},
        {"Code":"TT","Country":"Trinidad and Tobago"},
        {"Code":"TV","Country":"Tuvalu"},
        {"Code":"TW","Country":"Taiwan, Province of Chine (台灣)"},
        {"Code":"TZ","Country":"Tanzania, United Republic of"},
        {"Code":"UA","Country":"Ukraine (Україна)"},
        {"Code":"UG","Country":"Uganda"},
        {"Code":"UM","Country":"United States minor outlying islands"},
        {"Code":"US","Country":"United States"},
        {"Code":"UY","Country":"Uruguay"},
        {"Code":"UZ","Country":"Uzbekistan (O‘zbekiston)"},
        {"Code":"VA","Country":"Vatican City (Città del Vaticano)"},
        {"Code":"VC","Country":"Saint Vincent and the Grenadines"},
        {"Code":"VE","Country":"Venezuela, Bolivarian Republic of"},
        {"Code":"VG","Country":"Virgin Islands, British"},
        {"Code":"VI","Country":"Virgin Islands, U.S."},
        {"Code":"VN","Country":"Vietnam (Việt Nam)"},
        {"Code":"VU","Country":"Vanuatu"},
        {"Code":"WF","Country":"Wallis and Futuna"},
        {"Code":"WS","Country":"Samoa"},
        {"Code":"YE","Country":"Yemen (اليمن)"},
        {"Code":"YT","Country":"Mayotte"},
        {"Code":"ZA","Country":"South Africa"},
        {"Code":"ZM","Country":"Zambia"},
        {"Code":"ZW","Country":"Zimbabwe"}
    ]
}");

When I try to echo a Country with it's Code, it doesn't work:

echo $countryCodes->Codes->Code['AO'];

I don't think I understand the proper method to do this, how can I display the Country Name by searching the JSON with the Country Code?

share|improve this question
    
Codes is an array. Use an index [0], or a foreach loop. Try array.include-once.org –  mario Dec 30 '13 at 3:26
    
Then it only returns the first country –  Charles John Thompson III Dec 30 '13 at 3:26
add comment

3 Answers

You have an array so you have to search on the array using a foreach loop then you can check string and print the result

foreach($countryCodes->Codes as $Codes)
   if($Codes->Code == "IT")
      echo "Code: ".$Codes->Code." - Country: ".$Codes->Country."\n";

If you want you can use break or use a for loop to stop search in the array.

ah, You have to change the first and last " into '

share|improve this answer
add comment
foreach($countryCodes->Codes as $code)
{
    $i = 0;
    echo $code->Code;
    $i++;
}

That is how to print them all out.

share|improve this answer
add comment

I ended up reformatting the JSON data as such:

{"AD": {"Country":"Andorra"},"AE": {"Country":"United Arab Emirates (الإمارات العربيّة المتّحدة)"},"AF": {"Country":"Afghanistan (افغانستان)"},"AG": {"Country":"Antigua and Barbuda"},"AI": {"Country":"Anguilla"},"AL": {"Country":"Albania (Shqipëria)"},"AM": {"Country":"Armenia (Հայաստան)"},"AN": {"Country":"Netherlands Antilles"},"AO": {"Country":"Angola"},"AQ": {"Country":"Antarctica"},"AR": {"Country":"Argentina"},"AS": {"Country":"American Samoa"},"AT": {"Country":"Austria (Österreich)"},"AU": {"Country":"Australia"},"AW": {"Country":"Aruba"},"AX": {"Country":"Aland Islands"},"AZ": {"Country":"Azerbaijan (Azərbaycan)"},"BA": {"Country":"Bosnia and Herzegovina (Bosna i Hercegovina)"},"BB": {"Country":"Barbados"},"BD": {"Country":"Bangladesh (বাংলাদেশ)"},"BE": {"Country":"Belgium (België)"},"BF": {"Country":"Burkina Faso"},"BG": {"Country":"Bulgaria (България)"},"BH": {"Country":"Bahrain (البحرين)"},"BI": {"Country":"Burundi (Uburundi)"},"BJ": {"Country":"Benin (Bénin)"},"BM": {"Country":"Bermuda"},"BN": {"Country":"Brunei (Brunei Darussalam)"},"BO": {"Country":"Bolivia"},"BR": {"Country":"Brazil (Brasil)"},"BS": {"Country":"Bahamas"},"BT": {"Country":"Bhutan (འབྲུག་ཡུལ)"},"BV": {"Country":"Bouvet Island"},"BW": {"Country":"Botswana"},"BY": {"Country":"Belarus (Белару́сь)"},"BZ": {"Country":"Belize"},"CA": {"Country":"Canada"},"CC": {"Country":"Cocos Islands"},"CD": {"Country":"Congo, Democratic Republic of the"},"CF": {"Country":"Central African Republic (République Centrafricaine)"},"CG": {"Country":"Congo"},"CH": {"Country":"Switzerland (Schweiz)"},"CI": {"Country":"Côte d'Ivoire"},"CK": {"Country":"Cook Islands"},"CL": {"Country":"Chile"},"CM": {"Country":"Cameroon (Cameroun)"},"CN": {"Country":"China (中国)"},"CO": {"Country":"Colombia"},"CR": {"Country":"Costa Rica"},"CS": {"Country":"Serbia and Montenegro (Србија и Црна Гора)"},"CU": {"Country":"Cuba"},"CV": {"Country":"Cape Verde (Cabo Verde)"},"CX": {"Country":"Christmas Island"},"CY": {"Country":"Cyprus (Κυπρος)"},"CZ": {"Country":"Czech Republic (Česko)"},"DE": {"Country":"Germany (Deutschland)"},"DJ": {"Country":"Djibouti"},"DK": {"Country":"Denmark (Danmark)"},"DM": {"Country":"Dominica"},"DO": {"Country":"Dominican Republic"},"DZ": {"Country":"Algeria (الجزائر)"},"EC": {"Country":"Ecuador"},"EE": {"Country":"Estonia (Eesti)"},"EG": {"Country":"Egypt (مصر)"},"EH": {"Country":"Western Sahara (الصحراء الغربية)"},"ER": {"Country":"Eritrea (Ertra)"},"ES": {"Country":"Spain (España)"},"ET": {"Country":"Ethiopia (Ityop'iya)"},"FI": {"Country":"Finland (Suomi)"},"FJ": {"Country":"Fiji"},"FK": {"Country":"Falkland Islands"},"FM": {"Country":"Micronesia"},"FO": {"Country":"Faroe Islands"},"FR": {"Country":"France"},"GA": {"Country":"Gabon"},"GB": {"Country":"United Kingdom"},"GD": {"Country":"Grenada"},"GE": {"Country":"Georgia (საქართველო)"},"GF": {"Country":"French Guiana"},"GG": {"Country":"Guernsey"},"GH": {"Country":"Ghana"},"GI": {"Country":"Gibraltar"},"GL": {"Country":"Greenland"},"GM": {"Country":"Gambia"},"GN": {"Country":"Guinea (Guinée)"},"GP": {"Country":"Guadeloupe"},"GQ": {"Country":"Equatorial Guinea (Guinea Ecuatorial)"},"GR": {"Country":"Greece (Ελλάς)"},"GS": {"Country":"South Georgia and the South Sandwich Islands"},"GT": {"Country":"Guatemala"},"GU": {"Country":"Guam"},"GW": {"Country":"Guinea-Bissau (Guiné-Bissau)"},"GY": {"Country":"Guyana"},"HK": {"Country":"Hong Kong"},"HM": {"Country":"Heard Island and McDonald Islands"},"HN": {"Country":"Honduras"},"HR": {"Country":"Croatia (Hrvatska)"},"HT": {"Country":"Haiti (Haïti)"},"HU": {"Country":"Hungary (Magyarország)"},"ID": {"Country":"Indonesia"},"IE": {"Country":"Ireland"},"IL": {"Country":"Israel (ישראל)"},"IM": {"Country":"Isle of Man"},"IN": {"Country":"India"},"IO": {"Country":"British Indian Ocean Territory"},"IQ": {"Country":"Iraq (العراق)"},"IR": {"Country":"Iran (ایران)"},"IS": {"Country":"Iceland (Ísland)"},"IT": {"Country":"Italy (Italia)"},"JE": {"Country":"Jersey"},"JM": {"Country":"Jamaica"},"JO": {"Country":"Jordan (الاردن)"},"JP": {"Country":"Japan (日本)"},"KE": {"Country":"Kenya"},"KG": {"Country":"Kyrgyzstan (Кыргызстан)"},"KH": {"Country":"Cambodia (Kampuchea)"},"KI": {"Country":"Kiribati"},"KM": {"Country":"Comoros (Comores)"},"KN": {"Country":"Saint Kitts and Nevis"},"KP": {"Country":"North Korea (조선)"},"KR": {"Country":"South Korea (한국)"},"KW": {"Country":"Kuwait (الكويت)"},"KY": {"Country":"Cayman Islands"},"KZ": {"Country":"Kazakhstan (Қазақстан)"},"LA": {"Country":"Laos (ນລາວ)"},"LB": {"Country":"Lebanon (لبنان)"},"LC": {"Country":"Saint Lucia"},"LI": {"Country":"Liechtenstein"},"LK": {"Country":"Sri Lanka"},"LR": {"Country":"Liberia"},"LS": {"Country":"Lesotho"},"LT": {"Country":"Lithuania (Lietuva)"},"LU": {"Country":"Luxembourg (Lëtzebuerg)"},"LV": {"Country":"Latvia (Latvija)"},"LY": {"Country":"Libya (ليبيا)"},"MA": {"Country":"Morocco (المغرب)"},"MC": {"Country":"Monaco"},"MD": {"Country":"Moldova"},"ME": {"Country":"Montenegro (Црна Гора)"},"MG": {"Country":"Madagascar (Madagasikara)"},"MH": {"Country":"Marshall Islands"},"MK": {"Country":"Macedonia (Македонија)"},"ML": {"Country":"Mali"},"MM": {"Country":"Myanmar (Burma)"},"MN": {"Country":"Mongolia (Монгол Улс)"},"MO": {"Country":"Macao"},"MP": {"Country":"Northern Mariana Islands"},"MQ": {"Country":"Martinique"},"MR": {"Country":"Mauritania (موريتانيا)"},"MS": {"Country":"Montserrat"},"MT": {"Country":"Malta"},"MU": {"Country":"Mauritius"},"MV": {"Country":"Maldives (ގުޖޭއްރާ ޔާއްރިހޫމްޖ)"},"MW": {"Country":"Malawi"},"MX": {"Country":"Mexico (México)"},"MY": {"Country":"Malaysia"},"MZ": {"Country":"Mozambique (Moçambique)"},"NA": {"Country":"Namibia"},"NC": {"Country":"New Caledonia"},"NE": {"Country":"Niger"},"NF": {"Country":"Norfolk Island"},"NG": {"Country":"Nigeria"},"NI": {"Country":"Nicaragua"},"NL": {"Country":"Netherlands (Nederland)"},"NO": {"Country":"Norway (Norge)"},"NP": {"Country":"Nepal (नेपाल)"},"NR": {"Country":"Nauru (Naoero)"},"NU": {"Country":"Niue"},"NZ": {"Country":"New Zealand"},"OM": {"Country":"Oman (عمان)"},"PA": {"Country":"Panama (Panamá)"},"PE": {"Country":"Peru (Perú)"},"PF": {"Country":"French Polynesia"},"PG": {"Country":"Papua New Guinea"},"PH": {"Country":"Philippines (Pilipinas)"},"PK": {"Country":"Pakistan (پاکستان)"},"PL": {"Country":"Poland (Polska)"},"PM": {"Country":"Saint Pierre and Miquelon"},"PN": {"Country":"Pitcairn"},"PR": {"Country":"Puerto Rico"},"PS": {"Country":"Palestinian Territories"},"PT": {"Country":"Portugal"},"PW": {"Country":"Palau (Belau)"},"PY": {"Country":"Paraguay"},"QA": {"Country":"Qatar (قطر)"},"RE": {"Country":"Reunion"},"RO": {"Country":"Romania (România)"},"RS": {"Country":"Serbia (Србија)"},"RU": {"Country":"Russia (Россия)"},"RW": {"Country":"Rwanda"},"SA": {"Country":"Saudi Arabia (المملكة العربية السعودية)"},"SB": {"Country":"Solomon Islands"},"SC": {"Country":"Seychelles"},"SD": {"Country":"Sudan (السودان)"},"SE": {"Country":"Sweden (Sverige)"},"SG": {"Country":"Singapore (Singapura)"},"SH": {"Country":"Saint Helena"},"SI": {"Country":"Slovenia (Slovenija)"},"SJ": {"Country":"Svalbard and Jan Mayen"},"SK": {"Country":"Slovakia (Slovensko)"},"SL": {"Country":"Sierra Leone"},"SM": {"Country":"San Marino"},"SN": {"Country":"Senegal (Sénégal)"},"SO": {"Country":"Somalia (Soomaaliya)"},"SR": {"Country":"Suriname"},"ST": {"Country":"São Tomé and Príncipe"},"SV": {"Country":"El Salvador"},"SY": {"Country":"Syria (سوريا)"},"SZ": {"Country":"Swaziland"},"TC": {"Country":"Turks and Caicos Islands"},"TD": {"Country":"Chad (Tchad)"},"TF": {"Country":"French Southern Territories"},"TG": {"Country":"Togo"},"TH": {"Country":"Thailand (ราชอาณาจักรไทย)"},"TJ": {"Country":"Tajikistan (Тоҷикистон)"},"TK": {"Country":"Tokelau"},"TL": {"Country":"Timor-Leste"},"TM": {"Country":"Turkmenistan (Türkmenistan)"},"TN": {"Country":"Tunisia (تونس)"},"TO": {"Country":"Tonga"},"TR": {"Country":"Turkey (Türkiye)"},"TT": {"Country":"Trinidad and Tobago"},"TV": {"Country":"Tuvalu"},"TW": {"Country":"Taiwan (台灣)"},"TZ": {"Country":"Tanzania"},"UA": {"Country":"Ukraine (Україна)"},"UG": {"Country":"Uganda"},"UM": {"Country":"United States minor outlying islands"},"US": {"Country":"United States"},"UY": {"Country":"Uruguay"},"UZ": {"Country":"Uzbekistan (O'zbekiston)"},"VA": {"Country":"Vatican City (Città del Vaticano)"},"VC": {"Country":"Saint Vincent and the Grenadines"},"VE": {"Country":"Venezuela"},"VG": {"Country":"Virgin Islands, British"},"VI": {"Country":"Virgin Islands, U.S."},"VN": {"Country":"Vietnam (Việt Nam)"},"VU": {"Country":"Vanuatu"},"WF": {"Country":"Wallis and Futuna"},"WS": {"Country":"Samoa"},"YE": {"Country":"Yemen (اليمن)"},"YT": {"Country":"Mayotte"},"ZA": {"Country":"South Africa"},"ZM": {"Country":"Zambia"},"ZW": {"Country":"Zimbabwe"}}

This works much better.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.