How to use Json

Data tools and advice

Today in class we learnt how to extract data using JavaScript Object Notation (Json), a  format that is easier to read than xml. Data that comes in a Json format is also easy to collect, which is why it maybe worthwhile to learn for data enthusiasts.

There are simple steps to using Json and I outline them below.

Our class example was the UK postoffice API. A google search of UK postoffice API will lead to this url:

The url has an example API, which is listed on the section written as Return data for postcode. Copy the link

Paste the link onto a different webpage.

Then remove square brackets encircling postcode and (no space). Also remove the square brackets encircling xml, csv, Json and leave Json leaving.

Add your postcode. Some browsers will only allow you to open as a notepad.

If it opens in a browser copy and paste to a notepad.

When it downloads onto the notepad it will appear in linear format as in below

In the notepad a colon (:) denotes pairs so you have to separate the data into pairs

To do that press enter after the first comma

Press enter after geo and press the space tab to indent

Repeat process for the following pairs. New properties such as administrative don’t need to be indented.

Your notepad should end up something like this


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s