Full Country Names

Our API returns ISO-2 country codes instead of country names. Here you can see it returning "US" for a google IP:

curl ipinfo.io/

When displaying the country to the user you might want a full country name rather than the country code though. You can do this by using one of the mapping files from country.io. The country names JSON file has a mapping from codes to English names. Here are the first few lines from that file:

{ "BD": "Bangladesh", "BE": "Belgium", "BF": "Burkina Faso", "BG": "Bulgaria", "BA": "Bosnia and Herzegovina", "BB": "Barbados", "WF": "Wallis and Futuna", "BL": "Saint Barthelemy", "BM": "Bermuda", "...": "..." }

You can download and import that file into your project, and then use it to lookup the full country name given the country code from our API.