2017 © Pedro Peláez
 

library country-data

A simple but useful data of the world (by country) in JSON formats

image

samayo/country-data

A simple but useful data of the world (by country) in JSON formats

  • Tuesday, July 31, 2018
  • by samayo
  • Repository
  • 17 Watchers
  • 272 Stars
  • 19 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 110 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

country-json Build Status

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

Download

Using npm, (*2)

$ npm install country-json

or composer, (*3)

$ composer require samayo/country-json

or git, (*4)

$ 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., (*5)

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., (*6)

Resources

The Versions

31/07 2018

dev-master

9999999-dev http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

31/07 2018

1.0.7

1.0.7.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

31/07 2018

dev-alphabetize

dev-alphabetize http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

26/06 2018

1.0.6

1.0.6.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

24/06 2018

1.0.4

1.0.4.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

24/06 2018

1.0.5

1.0.5.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

05/04 2018

1.0.3

1.0.3.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

27/12 2017

1.0.2

1.0.2.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

20/02 2017

dev-dev

dev-dev http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country

08/02 2017

1.0.1

1.0.1.0 http://github.com/samayo/country-json

A simple but useful data of the world (by country) in JSON formats

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Avatar samayo

json data country