Week 08

Data

JSON (JavaScript Object Notation)

{
  "title": "Oldboy",
  "director": "Park Chan-wook",
  "year": 2003,
  "rating": 8.4
}
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25,
  "address": {
    "streetAddress": "21 2nd Street",
    "city": "New York",
    "state": "NY",
    "postalCode": "10021"
  },
  "phoneNumber": [
    {
      "type": "home",
      "number": "212 555-1234"
    },
    {
      "type": "fax",
      "number": "646 555-4567"
    }
  ],
  "gender":{
    "type":"male"
  }
}

We have played with JSON already.......

When we access the values in the JSON object.

Let's make your own .json file.

food.json

Let's validate

JSON with [Array]

https://github.com/dariusk/corpora/tree/master/data

We use AAA.BBB[ i ]

i as an index

API (Application programming interface)

It can be anything like CSV, XML, TXT, PDF but we want "JSON!"

Why?? J = Javascript

JSON VIEWER

Before >>>

After >>>

Simple API example

Sign Up here:

Try it here: Weather in London:

https://samples.openweathermap.org/data/2.5/weather?q=London,uk

?q=london,uk

?q=london,uk& ________ = ________ &________=_________

https://samples.openweathermap.org/data/2.5/weather?q=London,uk&appid=e4d37ccc2c4f3977c2e466fa78b38fcb

&units=metric

?lat=35&lon=139

Assignment

https://goo.gl/forms/lZGI0Nf5iW6GT1ei1

Last updated