Short for JavaScript Object Notation it is a data file for JavaScript programming that allows for data to be saved and exchanged. It’s written in plain text so you can read it with any program that lets you read text files. You can create JSON files to store and use data in your own project and other sites make their data available through the JSON format.


The json Format is essentially a JavaScript Object that contains a collection of name/value pairs (also called key/value). Here is an example

   "course": "MMP 350",
   "year": 2021


The values can be any one of these types:

  1. a string in double quotes: “my string”
  2. a number: 2021
  3. boolean: true or false
  4. null: null
  5. an object: { “name”: “value”}
  6. an array: [ “a”, “b”, “c”]

Here is an example

   "myString": "A string value",
   "myNumber": 2021,
   "myBoolean": true,
   "myNull": null,
   "myObject": {
   "myArray":  [ "a", "b", "c"]

Getting Data from Other Sites

When other sites make their data available they usually do it in one of two ways:

  1. Download: you download the file from their site, then save it with your site files and use it that way
  2. API: they have created an API which allows you to get the data on the fly through JavaScript code.

An example of the first type would be going to this page: https://data.cityofnewyork.us/Recreation/Directory-of-Basketball-Courts/b937-zdky

and downloading a .json file of all of the basketball courts in NYC.

An example of an API would be using the API described here: https://dev.socrata.com/foundry/data.cityofnewyork.us/25th-nujf

to dynamically load popular NYC baby names into a page. When you use an API you need to write code to load the data. This can by done through vanilla JavaScript or through a framework like jQuery.

Sort and Filter

When using an API you can sort and filter the data you return. For example this URL https://data.cityofnewyork.us/resource/25th-nujf.json?&ethcty=HISPANIC&gndr=FEMALE&rnk=1 will give you just the top-ranked female Hispanic names for each year available.

1 comment

Leave a comment