Familiarizing with the JSON
Lesson 4 of 10 in Coddy's Social media Search Project - Python JSON Fundamentals course.
In this lesson, we'll get familiar with the JSON structure containing all the information of users/pages in this social media company.
Here's a JSON object representing an employee:
{
"first_name": "Robert",
"last_name": "Newell",
"city": "Atlanta",
"type": "user",
"gender": "M",
"country": "United States",
"job": "Software Engineer"
}This is a single record in the database that represents the details of a user. Notice that the type is set as user.
Now let's pick another kind of entity in our social media - a page.
{
"name": "Friendly Neighborhood Coder",
"category": "Technology, Education & Engineering",
"city": "Trivandrum",
"type": "page",
"followers": 1080,
"country": "India",
"description": "Creator of the YouTube channel - @fncoder. I help python developers level up their skills"
}The final JSON you get from the social media backend service will be a list of records. Some of these will be user records, and some will be page records. A list of these JSON objects and assigned to a JSON array - results. Format will look like below:
{
"results": [
{
"first_name": "Robert",
"last_name": "Newell",
"city": "Atlanta",
"type": "user",
"gender": "M",
"country": "United States",
"job": "Software Engineer"
}, {
"name": "Friendly Neighborhood Coder",
"category": "Technology, Education & Engineering",
"city": "Trivandrum",
"type": "page",
"followers": 1080,
"country": "India",
"description": "Creator of the YouTube channel - @fncoder. I help python developers level up their skills"
}
]
}In some of the challenges in this course, you'll be seeing JSON objects in the above format.
Try it yourself
This lesson doesn't include a code challenge.
All lessons in Social media Search Project - Python JSON Fundamentals
2Social Media Users JSON
Familiarizing with the JSON