#100DaysOfCode in Python Transcripts
Chapter: Days 40-42: JSON in Python
Lecture: Inspecting JSON schema
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Okay, so to start we're going to look at a basic example of JSON output or JSON schema. Okay so it is pretty complex at times,
0:11
especially when it starts getting really deep. So just look at this basic example to understand it.
0:18
So from Python perspective, it looks pretty simple for now. This is a really basic one again and it's about a sort of person object
0:26
so you've got a title of a person. You got the type, it's an object. And then what are the properties of that?
0:32
Well there is a first name, a last name, an age, a description, and so on and so forth. What really gets people and gets me sometimes
0:43
with a JSON is once it's decoded in Python, all of these become nested dictionaries and lists.
0:52
And it makes it quite difficult when you're writing loops and what not to try and drill down to those nested dictionaries.
1:01
So looking at this, if this was formatted like a dictionary in Python, your first level of the dictionary has the key title value person,
1:12
key type value object. Key properties but the value of properties is another dictionary and that dictionary goes all the way down to here, okay.
1:25
And within that dictionary, you then have another key called first name whose value is yet another dictionary, okay.
1:35
And then that closes off here and then you have another key whose value is yet another dictionary and so on.
1:43
When you break it down visually, it makes a lot more sense. That said, it is still a little bit of a crazy process trying to drill down, okay.
1:56
And we're going to work through that in the next couple of videos. So this is just a nice basic example of what JSON schema looks like.
2:03
So have a good look at this. Wrap your head around it and move onto the next video.