DataGraph
Print

Link to JSON Files

The Link to URL/File option can be used to connect to online data sources using the JSON output format.

What is JSON?

JSON is a structured data format commonly used to transfer data on the web. In DataGraph, you can connect directly to JSON-formatted data. The data is refreshed every time you open the file, or click the refresh button on the object.

JSON is a very flexible format and not all JSON API formats will work in DataGraph. An example of an API that works well is the World Bank Indicators API. See the World Bank Indicators API documentation for more information and examples.

For information on JSON see Wikipedia.

Link to JSON Data

Select the ‘Link to URL/File’ option from the Other drop-down menu above the Column List. See the main page for the Link to URL/File option for more details.

This creates an empty Group. Try connecting to data from the World Bank. Enter the JSON call in the URL.

http://api.worldbank.org/v2/countries/all/indicators/SP.POP.TOTL

You will also need a key-value pair to specify the format as JSON.

Check the columns you want to include in your DataGraph file.

For each column you check, a column entry is created and the data is added to your file.

You can also rename and reorder the columns.

Key-Value Pairs

JSON requests from larger datasets may have the option of using key-value pairs to specify the data to return. For example, the World Bank API works with an argument-based URL request. Rather than constructing a very long request statement, you can enter each key-value pair.

Here is an example requesting a list of low-income countries (incomeLevel = LIC). Per the World Bank API documentation, the request can be made using:

https://api.worldbank.org/V2/country?incomeLevel=LIC

In DataGraph, simplify the request by separating the key-value pairs from the main URL. Enter the following for the URL:

https://api.worldbank.org/V2/country

Then add the key-value pairs as shown.

Troubleshooting

You can check the response of your API call from the JSON group.

A screen will pop up that shows you the complete URL, the text response, and a tree view of the response that you can explore.

On This Page