Giter Club home page Giter Club logo

country-json's Introduction

country>json Build Status

A simple data of the world (by country) each in JSON format.

Download

Using npm

$ npm install country-json

or composer

$ composer require samayo/country-json

or git

$ git clone https://github.com/samayo/country-json

List of contents provided in JSON formats:

Usage

Examples using various languages on how display/integrate the data.

PHP
$file = file_get_contents("./src/country-by-capital-city.json");

foreach (json_decode($file, true) as $key => $value) {
  var_dump($value); // { country: 'Afghanistan', city: 'Kabul' ..}
}
Node.js
var cities = require('./src/country-by-capital-city.json')

console.log(cities[0]); // { country: 'Afghanistan', city: 'Kabul' }
Ruby
require 'json'

file = File.read('./src/country-by-capital-city.json')
json = JSON.parse(file)

puts json[0] # {"country"=>"Afghanistan", "city"=>"Kabul"}
Python
import yaml

with open('./src/country-by-capital-city.json') as json_file:
    for line in yaml.safe_load(json_file):
        print line # {'country': 'Afghanistan', 'city': 'Kabul'}
Golang
package main

import (
  "encoding/json"
  "fmt"
  "io/ioutil"
)

func main() {
  data, err := ioutil.ReadFile("path/to/country-by-capital-city.json")
  if err != nil {
    panic(err)
  }

  var entries []struct{ Country, City string }
  if err = json.Unmarshal(data, &entries); err != nil {
    panic(err)
  }

  for _, entry := range entries {
    fmt.Println(entry.Country, entry.City)  # {'country': 'Afghanistan', 'city': 'Kabul'}
  }
}

Contribution

Feel free to send a PR to fix, update or add new entry anytime. For non-minor changes (ex: country: name, language, city, independence date..), please include a source, if possible.

Resources

country-json's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

country-json's Issues

Null values for country by abbreviation

The following entries have null values for the abbreviation field.

{ // Should be removed
   "country": "England",
   "abbreviation": null 
},
{
   "country": "Kazakstan", // Renamed to Kazakhstan
   "abbreviation": null // Replaced with KZ
},
{
   "country": "Micronesia, Federated States of",
   "abbreviation": null // Replaced with FM
},
{
   "country": "Northern Ireland",
   "abbreviation": null // Replaced with GB
},
{  // Removed
   "country": "Scotland", 
   "abbreviation": null
},
{
   "country": "South Sudan",
   "abbreviation": null // Replaced with SS
},
{
   "country": "SriLanka", // Renamed to SriLanka
   "abbreviation": null // Replaced with LK
},
{
   "country": "The Democratic Republic of Congo",
   "abbreviation": null // Replaced with CD
},
{
   "country": "Virgin Islands, British",
   "abbreviation": null // Replace with VG
},
{
   "country": "Virgin Islands, U.S.",
   "abbreviation": null // Replace with VI
},
{ // Removed
   "country": "Wales",
   "abbreviation": null //
},

Some should be removed and some needs to be updated
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

Yugoslavia doesn't exist

You have info about country that doesn't exist anymore. It got broken into several smaller countries since 1991. [1] Even thou remaining two countries from previous federation have been using old name, they've also parted ways. First country was renamed to "Serbia and Montenegro" back in 2003. [2] Then in 2006 they've parted ways and each country started using their own names, Serbia [3] and Montenegro [4] respectfully.

Project covers some of those former republics of Yugoslavia but not all of them as it should.

So, someone should update the list with such changes :-)

Great project btw. 馃憤

[1] - https://en.wikipedia.org/wiki/Yugoslavia#New_states
[2] - https://en.wikipedia.org/wiki/Serbia_and_Montenegro
[3] - https://en.wikipedia.org/wiki/Serbia
[4] - https://en.wikipedia.org/wiki/Montenegro

some countries missing from population

population was missing these countries for me:

1: "Cabo Verde"
2: "Channel Islands"
5: "Cura莽ao"
7: "Eswatini"
9: "Fiji"
10: "Isle of Man"
11: "Kosovo"
12: Congo was listed as 0?
14: "Serbia"
15: "Sint Maarten"
16: "Sri Lanka"
17: "St Martin"
18: "St. Barth"
19: "St. Vincent Grenadines"
20: "Taiwan" (????? political...?)
21: "Timor-Leste"
25: "Vatican City"

(I tried to remove ones I noticed had a match but were spelled differently by eye, sorry if I missed any)

Inconsistent Country's Name

Hi, I just read (scanning to be precise) all your file under scr and just one thing bugs me.
I found that Ivory Coast and C么te d鈥橧voire are the same country.

Most of the src's files are using C么te d鈥橧voire, while the other are using Ivory Coast and one file just using Ivory.

I make the list of files that not using C么te d鈥橧voire

So, I suggest that you have to choose between them either C么te d鈥橧voire or Ivory Coast for consistency, even thought both of them are true.

Data sources

Is it possible to provide with data source links? I mean where are those data coming from.

Question: ISO? Source?

Hi this is just a question for the repo maintainer. Well, 3 questions:

First of all thanks for putting this up, great idea to have it as an npm package too!

  1. Does src/country-abbreviation.json follow an ISO (in its abbreviations)?
  2. What's your data source?
  3. How often do you think this will be maintained, as the recognized countries vary slightly over the years?

Best.

national-dish json typo

In country-by-national-dish.json for India, there is a typo in the national dish
Instead of
"No officially anointed national dish"
It should probably be,
"No officially announced national dish"

Could not find a matching version

When trying to install it using composer I get

Could not find a matching version of package samayo/country-json. Check the package spelling, your version constraint and that the package is available in a stability which
matches your minimum-stability (stable).

Any ideas what could be the issue?

Please add Montenegro

I received a request to add Montenegro (+382) as a country in country-by-calling-code.json. Thank you.

many incorrect language labels

about half of the fields in languages are incorrect. For example, Chinese is not the official language of the United States nor Arabic for Australia

How old and accurate is the data?

I noticed that some of data is inaccurate. For example the population of Bulgaria is said to be around 8 millions, but that was the number back in 2001. Maybe you should consider updating?

Reference

"acronym" isn't acronyms

I hate to be That Guy, but the file named country-acronym should be country-abbreviation.

An acronym is a word made up of initial letters from a phrase, like "laser". Things like "CK" and "LHR" are abbreviations.

How to find Dial code along with continents?

Hello,
I am trying to find countries json with dial code,continents and country name because i need to filter countries based on continents.

It would be really helpful if you provide the same
Thanks

composer fails

I've tried to use in composer, but get next message:

[InvalidArgumentException]
  Could not find a matching version of package samayo/country-data. Check the package spelling, your version constraint and that the package is available in a stabili         ty which matches your minimum-stability (stable).

Then I added it manually to composer.json and tried to update, and get that:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package samayo/country-data could not be found in any version, there may be a typo in the package name.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
 - It's a private package and you forgot to add a custom repository to find it

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Anyone knows what happens? Thanks

No package on packagist?

I'm trying to install the package and have in my composer.json

samayo/country-data: "^1.0"

This worked before but now I'm getting an error:

The requested package samayo/country-data could not be found in any version, there may be a typo in the package name.

I searched on the packagist and cannot find it anywhere.

Was the package removed?

Issue on json files

These files has some issue concerning data of some countries. There is no countries name Kosovo, Montenegro, Serbia. There is an old name of these new countries called Yugoslavia. There is no more country name Yugoslavia right now. Rather it should be replaced by those three countries mentioned above. Need big time fix.

Bosnian language - Bosnia and Herzegovina

Please add the Bosnian language as an official for Bosnia and Herzegovina

country-by-languages.json

{"country" : "Bosnia and Herzegovina", "language": "Bosnian"}

Denmark - Copenhagen

{"country" : "Denmark","city" : "K"},

Should be K酶benhavn, so I guess there is a encoding problem here?

Concatenate all country data into single file

Currently all the data is separated by category into different file. I think it would be nice if there provided single file contain all the data. Ideally it would be concatenated by a build script.

some flags are wrong

why are the first country has 4 flags ? and not right !

file:country-by-flag.json
pls check !

country-capital-city data is quite broken

It seems that cities with non-ascii symbols are cut off.

For example:

{"country" : "Brazil","city" : "Bras"},
{"country" : "Costa Rica","city" : "San Jos"},
{"country" : "Faroe Islands","city" : "T"},

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.