The data are stored as Numbers, Strings, Booleans, Arrays, or Objects.
So if you want to know a little bit more about JSON the best place to start again,
as usual, is actually Wikipedia.
This link will take you to a lot more information about JSON.
So this is an example JSON file.
It actually comes from, this is the API for github.
And this is actually the data about the repos that I am contributing to.
And so, what you can do is go here and look at this file.
And so, there's a overall curly bracket that
represents the sort of entire JSON object.
And then, each of the different repos is inside of its own separate curly bracket.
And so each repo has a bunch of variables associated with it, so for
example the ID variable or the full name of the repo and all that.
And so what you see is the structure of a JSON file and
sort of the ID followed by a colon followed by the value of the variable.
And so you can have nested sort of structures within, so
for example an array can be a component of the JSON objects.
So, for example, the owner variable here actually has an array as the value,
so you could see there's the colon, and then there's another open curly bracket.
And then there's a whole bunch of variables, like my login, and
the avatar URL, and all of that different information.
So there is actually a very nice package for reading this data in.
It's called the jsonlite package.
So what you do is you actually take the URL where the JSON appears, so
here's that URL, and you pass it to the fromJSON function.
And what you get out is a structured data frame.
So if you look at the names of that data frame, it's gonna be all the top level
variables, things like ID, and name, and full_name and so forth.
So one of those variables as you can see is owner.
So that's one of the components of this data frame.
So if we drill down a little bit and look at the names of that particular variable,
you see names(jsonData$owner).
So usually this would access one column of the data frame.
And so it turns out you can actually, because of the flexibility of data frames
in R store the data frame within a data frame.
So within that column of the data set,
the owner column, there's actually a bunch of other information.
Cuz you remember owner corresponding to an array of values.
So you get again, the login, the id, say, the avatar_url and so forth.
So we can drill down even further and so we can access, say, for
example the log n of all the different repos on this particular page.
And since we're only looking at the API for my repos, you can see that the login
is the same for all of them, it's jtleek in every single case.
And so you can see there's one time for
every single repo that exists in that data set.