What is JSON?
Lesson 2 of 10 in Coddy's Social media Search Project - Python JSON Fundamentals course.
JSON stands for JavaScript Object Notation. This is a popular format for storing and exchanging data.
Here's a sample JSON object
{
"id": 101,
"name": "Alfred Dines",
"address": "Obere Str. 57",
"city": "Atlanta",
"country": "USA"
}The above JSON object contains 5 properties - id, name, address, city, country. These properties together form a meaningful representation of the object which is a data record of Alfred Dines.
In a JSON, everything included inside curly braces { } is a single object. Every property or object inside these braces belongs to the original object.
Array of objects are represented using square brackets [ ]. An example is given below:
"customers": [
{
"id": 101,
"name": "Alfred Dines",
"address": "Obere Str. 57",
"city": "Atlanta",
"country": "USA"
}, {
"id": 101,
"name": "Boris Klassen",
"address": "Obere Str. 57",
"city": "Amsterdam",
"country": "Netherlands"
}
]In the above example, we have an array of objects called customers and there are 2 objects within it representing information about Alfred Dines and Boris Klassen.
Try it yourself
This lesson doesn't include a code challenge.