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
https://www.quandl.com/api/v3/datasets/ gives direct access to JSON formatted data with the following command:
Table 11.1. Example of data from the Quandl.com catalog
|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):
"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" ],
"data": [ [ "2015-12-31", 6.29 ], … ]
11.1.2. Processing an example with promises
Knowing that structure ...