Now I want to move on to data formats. So data formats is an exam objective.
So we have to have a general idea what a data format is and we're going to have to be able to
read a certain type of data format for the certification exam. So what is a data format?
A data format is how the information is presented so that way it can be consumed. So the CLI is a
data format. JSON is a data format. XML is a data format. YAML is a data format. So what do you use?
Well, it really depends on who the consumer is. So if a human being is consuming it,
CLI is pretty good. See, the CLI was created for human consumption.
But things like JSON, YAML, and XML, they're not really designed for human consumption.
They were more designed for what? System consumption. So when one system wants to
talk to another system, it makes sense to use things like JSON, XML, and YAML.
And when you and I need to consume something from the device, it makes more sense to use the CLI.
But see, what's even better is for our systems to be able to talk to each other and consume
information using these formats, but for us to use a web-based interface, graphical user interface
that can interpret this stuff and make it in a nice presentable format. So that's the idea here.
So even though we might be using JSON, XML, or YAML between our devices,
when we want to see that information, it would be better that we had a web-based graphical
user interface to see that or the CLI. So here are three, the three data formats. And what I
want you to just get away from this information here is that if you look at them, it's all the
exact same information, just presented to you, displayed to you in a different way. That's all.
So if you look at the JSON information versus the XML information versus the YAML information,
just look at the final few entries, like EtherStats. Look at EtherStats right now. It's
here. It's here. It's here. But it's just simply formatted in a different way. That's what we're
talking about. This is all about formatting. Formatting. That's all these are, formats.
So it's all the same information just displayed in different formats. So
what do we want to know for the exam? It's JSON.
JavaScript object notation. Apparently, it's a human-readable data format for applications to
store, transfer, and read data. Really? Human-readable? All right. It's better than XML.
But for a newbie, a new person, a noob, that's not easy to read. You know what's easy to read to me?
If this was presented to me in a web page as a graphical user interface, where all of this was
nicely presented in a chart form, hey, that would be good for me. Am I a JSON expert? Nope.
Do I ever really want to be at this point in my life? The answer is no.
But what I do need to know is how to read it. And that's what I'd like all of you to be able
to do for the exam. Just read it. Understand what is going on. And if you can do that,
you're going to do well on the certification exam.
So this is what I'd like to do. I'd like to just go into my live environment here
and pull this up, the same thing that we just had on the screen in this notepad file.
Why? So I can draw on it. That's what I want to do. All right. Let's get over the top.
I've got to open the program so I can draw on it.
All right. So here we go.
So what do we need to learn here? We need to learn that first and foremost,
you are going to have different
characters in different positions. And if you can memorize
where they typically go, what they're used for, you'll be able to answer the JSON questions on
the exam. So first thing I want to point out to you is that we have a colon.
And what are colons used for? Colons are used to separate what we call key value pairs.
So when we're dealing with JSON, we're dealing with key value pairs. So look at this example.
We have a key value pair. We have a key value pair. Now, if we go down a little bit further,
this is where things can get a little bit confusing. But you'll notice here we have a key.
Where is the value? Well, all of this is its value.
All of it is its value.
So statistics, key, all of these are values. But then you have key values inside of that.
You have key values inside of that.
So don't let that throw you off. It shows up like that on the exam.
So here, key statistic and value is all of this. Value is all of this. Value is all of this. But
key value, key value. So the values themselves are also key values
because of the way it's being structured. But they're key values. Okay. So first was key values.
And what's something else we want to point out here? Notice how you can have quotation marks.
Around what? Strings. So words, strings are going to have quotation marks.
In this case, that is a number. It's a number, an integer. So as a result of that,
it's not going to have quotation marks. But then you might have a number.
It's a number, an integer. So as a result of that, it's not going to have quotation marks.
But then you might be saying, well, wait a second. Why does this number or this number not have
quotation marks? Because that would be a string in this case. So even though it's a number,
it's being represented as a string in this case. And that's okay.
Okay. So quotation marks are fine. I like that. So you see quotation marks in a sample.
That is JSON. You see key value pairs like that. That is JSON. All right. We have curly braces
for opening and closing. So open. So therefore, there has to be one that closes somewhere else.
Like here, you see this one opens. So there's got to be someone,
there's got to be another one that closes it somewhere else. And look, it opens again.
And there's got to be one somewhere that closes that one. You can see it's right down here.
It's right at the bottom, right in there. Right there.
There it is. Now, what else do I want to point out to you? Let's point out commas.
Commas. So commas are valid as well.
So what I want you to notice is after every key value pair, we have a comma. You see that?
When do I not have a comma in the very last key value pair
before the closing bracket? No comma there.
So there's a comma after every single key value pair until you get to the last key value pair
before you close your bracket. So if we look at that, where's the comma? It's after the bracket
instead of after the key value pair.
Key value, comma. Key value, comma. Key value, comma. Comma, comma. All right. Key,
open bracket. Comma, comma, comma, comma, comma. Now I'm going to start singing. All right. No
comma. It comes after the bracket. All right. So what do I want you to notice?
This is all that is required to know, folks. Can we have square brackets too? Yeah,
we can also have square brackets. We can have square brackets for an array. An array.
A-R-R-A-Y. Array. There you go. Small. Got large there for a second.
Okay. So this is just something you're going to have to take some time to just memorize the
I am frozen here, folks. I don't know if you are frozen.
Let me refresh this. Can everyone hear me okay? Too many commas, I think.
Yep. It looks like it's frozen. I'm not even getting. Okay, folks.
I'm going to refresh stream.
I will refresh stream.
All right. It's resetting stream now. Okay. Looks like I'm connected.
Okay.
Still trying to verify everything on my end.
Okay. Looking good now. I think we're good. Looks good for me.
All right. I think we're good. Give everybody a couple more seconds.
There we go. Yep. We are good to go. There we go. If you can't see me, refresh.
All right, folks. All right. Where were we here? So the key for the exam is to take the time
to know what is valid JSON syntax, meaning key values with a colon. If there's anything else
between them, that's wrong. Curly braces at the start, curly braces at the end. If you open it,
if you have to create what you see here, curly brace goes there. If they put any other type of
bracket in that case, it's not right. You might see a square bracket and that would be okay
because I'm going to show you momentarily where you could use that square bracket.
Right. So that's fine. Quotations are good, but if they show you something else, but instead of
quotations, they're using exclamation marks, right, or they're using apostrophes and different
things like that. Okay. Those are wrong. Those are distractors, right? The goal here is to simply know
what is valid versus not valid. So I have a secondary example here.
And let's say I told you brand is Ford, name is Mustang, year is 2001. Attributes are black,
five liter with a sunroof. How can we display this in JSON formatting? Well, open your bracket
and then we have key value pairs, brand Ford, name Mustang, year 2020. Attributes,
look at the square bracket there. So instead of curly, we're using square,
black, five liter, sunroof. So why square instead of curly? Because notice we don't
have key value pairs here. So if there were key value pairs here, then we would have curly
brackets. But since we don't have key value pairs here, then we're just going to go ahead
and have the square brackets. And then close it off. And notice no comma here at all. Oops,
need my comma. There you go. My bad. Better save it. So there you go. You have your comment
at the end. So not at the very last value. So key, and these are all your values. So now you
put the comma at the end, right there, not there. All right. So and look at this, this exact same
thing can be written like this. There you go. So that means the same thing. And that's why
when you first learn about this, if you're looking at it this way, it's like, well, why do
we do this? Because in reality, that's just this way. So you can understand it. But in reality,
the devices see it like this. So open it up. Brand is for comma. So these go together.
These go together. These go together. All of this goes together.
Black, right? That's the idea behind it. So make sure you can pick out valid versus invalid. So,
for example, if these commas were semicolons, wrong. If the colons were underscores, wrong.
If these were square brackets, wrong, right? Pick the one that is accurate.
Okay, so why no quotes around 2020? Because 2020 is not a string, it's an integer. So because I
don't put quotes around it, it's an integer, it's a number. So like in this example here,
it's a number, not a string. This would be a string. That's a string. Even though it's a number,
it's represented as a string. This one's represented as a string. But this one's
truly a number, truly a number, truly a number, truly a number, right? If there's no quotes,
if there's no quotes, it's truly an integer. And so when you're programming, like in Python,
as an example, integers can be added together, subtracted, multiplied, divided. But if the
number was a string, you can't do that. You'd have to convert the string to an integer to do
your math and all that stuff. So this is truly 100% a number, where this is a number as a string.
So it can't be treated as a number for mathematical calculations. That's why.
So no quotes around 2020, because I want this to be a real number in this case.
But if I had quotes around it, then it would be a string. That looks like a number.
All right, so that's JSON, JavaScript Object Notation. Our goal for the exam is to be able
to do what? Identify the valid syntax. So they might present four different options for you and
say which one's valid. Could be as easy as that. Could be as easy as that. All right, so now we
have to consider the fact that if we're using JSON formatted data, and we are sending that over the
internet, and how are we doing that, potentially? Oh, well, we'd be using HTTPS with REST API,
so that's okay. But we also want to make sure that we protect our actual JSON data as well,
the JSON information. So we have these things called JSON Web Tokens. JSON Web Tokens,
also called JWTs, JWOT, is a compact, self-contained way to securely transmit
information between parties as a JSON object. Sent through the URL, post parameter inside an
HTTP header, and it contains all the needed information that is required in order to do what?
In order to validate the actual token and validate the information that is being transmitted.
So I did a little sample here. I went to a website that could create a JSON Web Token for me,
and so in this case here, I specified my algorithm and token type.
I made some fake data, and so my fake data was just Encore exam example,
and then I had to provide a signature. And so the signature using HMAC SHA-256,
look what I wrote, and I said, I will pass Encore exam. So a little bit of subliminal messaging
here. What I want to point out to you is that a JSON Web Token, taking the header information,
your actual data itself that you're trying to protect, and then a signature, in this case, my
passcode that I have, ultimately ends up creating this right here.
This. So all of this is this now. And as a result of that, what do we have? This is the header.
Followed by a period. Followed by what? Our payload.
Followed by a period. Followed by the signature.
Header, period, payload, period, signature. Repeat after me.
Header, period, payload, period, signature.
So we can use this now for authentication, authorization, and for the information exchange
to protect our JSON data. Now, do we have something like this for other options like XML? Yes,
we do. Okay, so I just want to show you this. This is not exam relevant when I'm about to show you,
but just to show you how all of this information, I was able to produce this.
If we were using XML, we would have to use something called SAML.
SAML. And watch how big the SAML token becomes.
And look, there's a scroll. Okay, that's massive. So JSON web tokens are way less verbose
than XML. So the JSON web token ends up being smaller, and so it's a really great choice
for use with HTML. And we can use public-private key pairs and X509 certificate signing as well
with JWOTS. We have the HMAC algorithm, as we saw earlier, right here. So for the exam,
you don't have to know how to create these. That's not the point of my demonstration here
of using this and showing it to you. The point is to realize that we have, you know,
the ability to take that header, payload, signature, separate them by periods,
and this is our encoded data, making it, giving us the ability to do the authentication,
authorization, and safe information exchange that we want to.
Thank you for your attention.