#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
0:02
a basic example of JSON output or JSON schema.
0:07
Okay so it is pretty complex at times,
0:10
especially when it starts getting really deep.
0:14
So just look at this basic example to understand it.
0:17
So from Python perspective, it looks pretty simple for now.
0:22
This is a really basic one again
0:23
and it's about a sort of person object
0:25
so you've got a title of a person.
0:28
You got the type, it's an object.
0:29
And then what are the properties of that?
0:31
Well there is a first name, a last name, an age,
0:35
a description, and so on and so forth.
0:38
What really gets people and gets me sometimes
0:42
with a JSON is once it's decoded in Python,
0:47
all of these become nested dictionaries and lists.
0:51
And it makes it quite difficult when you're writing loops
0:55
and what not to try and drill down
0:57
to those nested dictionaries.
1:00
So looking at this, if this was formatted
1:03
like a dictionary in Python, your first level
1:07
of the dictionary has the key title value person,
1:11
key type value object.
1:14
Key properties but the value of properties is
1:18
another dictionary and that dictionary goes
1:21
all the way down to here, okay.
1:24
And within that dictionary, you then have
1:28
another key called first name whose value is
1:31
yet another dictionary, okay.
1:34
And then that closes off here and then you have
1:37
another key whose value is yet another dictionary and so on.
1:42
When you break it down visually, it makes a lot more sense.
1:47
That said, it is still a little bit of a crazy process
1:53
trying to drill down, okay.
1:55
And we're going to work through that
1:56
in the next couple of videos.
1:58
So this is just a nice basic example
2:00
of what JSON schema looks like.
2:02
So have a good look at this.
2:04
Wrap your head around it and move onto the next video.