Skip to Main Content
JavaScript and Open Data
book

JavaScript and Open Data

by Robert Jeansoulin
August 2018
Intermediate to advanced content levelIntermediate to advanced
272 pages
5h 3m
English
Wiley-ISTE
Content preview from JavaScript and Open Data

11Chronological Data

11.1. Accessing a JSON file via AJAX

This example is characteristic of many sites that provide access to chronological data, generally under CSV and JSON formats.

Quandl.com is a data warehouse which basically sells financial data. It also gives free access to economic and demographic data, mostly from public sources such as the World Bank, the European Central Bank (ECB), Euronext and the French office of statistics INSEE or from universities such as Yale Department of Economics and Paris School of Economics.

11.1.1. Quick presentation of the Quandl API

The directory https://www.quandl.com/api/v3/datasets/ gives direct access to JSON formatted data with the following command:

GET
https://www.quandl.com/api/v3/datasets/{db_code}/{data_code}.json

Table 11.1. Example of data from the Quandl.com catalog

db_code data_code
PSE (Paris school of economics) USA_1010120401 (Top 0.5-0.1% income share - USA, excluding capital gains)
INSEE 63_001686811_A (Population of 60+ years in France - mainland)

The JSON data structure is normalized as in this example (excerpts):

{
  "dataset": {
    "name":"World Top Incomes - Top 0.5-0.1% income share - United States",
    "description":"Units=%. Fractiles: total income excl. capital gains",
    "column_names": [ "Date", "Value" ],
    "frequency": "annual",
    "start_date": "1913-12-31",
    "end_date": "2015-12-31",
    "data": [ [ "2015-12-31", 6.29 ], … ]
  }

11.1.2. Processing an example with promises

Knowing that structure ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Wrangling with JavaScript

Data Wrangling with JavaScript

Ashley Davis
Web Applications with Javascript or Java

Web Applications with Javascript or Java

Gerd Wagner, Mircea Diaconescu

Publisher Resources

ISBN: 9781786302045