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 ...

Get JavaScript and Open Data now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.