Cisco CCIE Security 350-701 – JSON Data Encoding

  • By
  • February 23, 2023
0 Comment

1. API Data Formats

Now in this section we’ll be moving on with some kind of JSON data encoding. So we’ll try to understand the concepts of the JSON and we’ll also see some of the benefits of the JSON and then the different data types or the value types used inside the data encoding with JSON. And also finally we’ll also try to see some of the syntax rules with the JSON encoding. So, before we go ahead, we already seen in the previous sections like the APIs application program interface and then the web based API. And also I have covered some overview on the other APIs as well, the best API. So basically what is the job of the API? API is like an intermediate, like it is going to provide or allow the two different applications to talk to each other. Like if you take an example here you have some Sdn controller, it has to be communicating with the networking devices.

So there is an API and also the applications when they are trying to talk to the controller, there is an API. Of course it’s called northbound API and then this is Southbound API. So whatever the API, whether it is relating to networking or whether it is relating to any other kind of coding, probably there is something called API involved and the API is responsible for allowing the two applications to talk to each other. So probably they send the request and get the information. Now while the process is going on between these two. Now, what exactly the data format of that particular communication process? So what is the format? So what is the format they are going to agree on so that they can understand each other, they can understand each other information or they can talk to each other or how exactly the information has to be displayed. Because whatever the information is being exchanged between the two applications, they should understand each other.

So they’ll understand only each other, only if the information is displayed in a proper format which both can read. Both can read and communicate. So basically there must be agreed upon one kind of format that is what we call as data format and there are different data formats. Again if you take a simple example to understand more better like you can take an example of if you go to any kind of business shop probably where you do have some kind of menu you will find and in that menu again you will have the list of items available along with some kind of screenshot or a photo of that probably, which is again provide you some details like the photo and then captions, which are like easy to identify and communicate with the shop properly.

So when you are going to order it, so that it becomes easy for us to convey our message to the pizza shop to get your order. Same way here as well, when any application is trying to communicate with another application. When they are trying to talk to each other, they must agree on one kind of format so that they can understand each other. Okay? So data formats are nothing but the formats which are used between the two applications so that they can understand each other. That’s something what I explain regardless what API you are using.

So regardless of what is the API you’re using irrespective of the API, okay? Irrespective of what application they are using, where exactly you’re using. So it’s like a common terminology for any kind of API to API, API communication between the applications. Now, the importance of the data format is like the API is not going to work. Like I said, API is going to allow the application to talk to the server application between them. And this is not going to work if the data format is not the same. Just like I’m speaking in one language and you are speaking in a different language. So probably that’s not a proper way of communication. So similar with the sender and the receiver, they must agree on one common format, compulsory. If it is incorrect, then probably that will impact the communication. So mainly there are three types of API formats.

You have something called YAML, XML and JSON. And these three different formats, a lot of APIs, if you take most of the APIs, they typically use either an XML or the JSON format. Now again, if you compare again with JSON and XML, probably a lot of documents will tell that the JSON is a kind of more superior to the XML because it’s providing more simple readable options when compared to other options. Again, if you have a choice to select which because it totally depends upon the API what you’re using. So if you have a choice to understand the coding, probably the rate of formats, you always prefer to use JSON. This section also we are going to focus on the JSON coding. But again, even if you know and understand one coding, let’s say probably what you can do is you can use some kind of online converters. Now these converters will help you to convert from one format to another format. Like here you can see I got some kind of XML format code.

This is the actual output of my router showrun interface. Let me show you from where I got this output. So I got my router command line and this is the actual output what is pre configured on my interface. Now, probably if you want to get this format, what I can do is I can simply add a format option. So when you do that, it is going to display the XML code. And if you see this is the XML coding. So I’m going to copy this, I’m going to delete this one and then I’m going to copy this one. And then when I click on this XML to JSON and you can see I can see the JSON coding as well as the XML coding.

So similarly, you can convert from YAML to XML as well using some kind of websites. Now, this is something recommended. Probably you do have some converters. So what I generally prefer or suggest is even if you can learn any one of the coding, and if you’re using maybe XML in your APIs, probably you can use these converters from JSON to the other one, especially networking like you can see this is the same output. If you want to do some kind of configurations relevant to this. You can see this is more like a readable format. We’ll talk more on the JSON coding in the next topics. But you can see if you try to compare this one with XML code, probably this is a little bit less readable compared to the JSON options.

2. JSON Overview

Get into the JSON overview. Now, JSON stands for JavaScript object Notation, which is pronounced as JSON. So many new APIs use this JSON format. So probably most of the APIs you see, they will be using this JSON format. And this JSON is a little bit based on one of the code code programming language. That is what Java as the name itself says. Like Java is one kind of programming language. It’s a kind of coding language you can say, which is typically used for designing some kind of websites based on like HTML CSS format options or even it is used to develop some kind of applications as well. Web applications, programs are written even it is used in kind of scientific supercomputers gaming consoles. So the Java is kind of programming language. But again, when you come to this JSON, JSON is not a programming language. So it is actually a data format. Of course, it is based on the Java as well. So it’s a data format which is more human readable, which means you can by seeing the coding, you can easily read what exactly the code represents, more kind of readable text. And it’s going to use some kind of objects, attributes, variables. We’ll talk about them in the probably in the next sections. And when you compare this JSON with any other data formats, like if you compare this with any XML data format. So JSON is kind of lightweight when you compare with that.

And again, it is very easy to write, read and write as well. Again, inside this JSON, again, we have some kind of JSON objects. We’ll talk about that in the next. As I said, JSON objects is again representing your data, how it is transferred between the applications. Okay? So technically we call them as objects, which consists something called attributes and value page probably. And JSON is widely used in web service APIs. Like in the API section we have discussed something called Rest API which is commonly used between the applications and the SGN controller.

It is a little bit relevant to us. So the API is whatever the API is used here, that is your Rest API. It uses the JSON encoding. Okay, not only this, of course there are many other APIs which do support the JSON encoding. Okay? So JSON coding format and majority of this, majority again uses this JSON API, sorry, the JSON coding here. So probably in our SGN section, again, it is a little bit relevant with our SDPI, the Rest APIs which are used to talk between the applications and the controller. So that’s the reason we’ll be seeing here. The JSON data format again.

Now, if you try to compare the JSON, like what are the benefits we get when you compare with an XML here? That’s what we’ll try to see here. As I said, it is going to be lightweight. Now, lightweight is like it requires less characters probably to represent a specific data, it uses lesser characters compared to the XML. You can see the coding here, this is the same equivalent code of JSON XML. So lesser number of characters to describe a specific data which is used between the applications for an API. So probably you always prefer the JSON data format over XML because of this lightweight feature. Now again, one more benefit is like it is easy to read and write. So especially for the humans, you can clearly see while you’re reading, you can see, okay, it’s describing the website, the number of employees, phone numbers. So it’s kind of more easy format when you compare with XML here.

Now again, whatever the format you’re using, like here you can use this link like I used earlier. When you click on this link, this website will provide you some kind of JSON to XML coding where I can go and copy some format. I can use a complete showrunning config as well, but I’m going to be more specific. Like I’m going to say showrun interface at zero by zero. This is the actual configuration, what I have on my router. And by default if you want to just get the code, generally the router I was display in the form of XML code.

Like here you can see this is a show run, complete show run, but I don’t want the complete show run. So I can simply say only display the interface f zero by zero code. And this is your XML code. And if I go to this specific website here, like here, this is the same link URL like I showed you in the previous interaction as well. If I copy paste this, I can convert this into the JSON code. So probably even if you know any one coding or if you have any one code data format, you can easily convert that into equal and other code which is used by the API. Okay, so you can see here, if you try to read, it is more human readable. You can clearly see the IP address interface and then some configurations available on that particular interface even compared to the XML.

Here you can see XML. It is quite difficult to read in general. So that’s what next point says here it is a text based more human readable and more data extent format is. And one more advantage we get with the JSON is it is language independent. Now, the language independent means like generally the JSON, even though it is written in context of the JavaScripts, because it is a little bit slightly based on JavaScripts, because whatever the syntax or whatever the objects we use, they are a little bit relevant to JavaScript.

But again, you don’t need to learn the JavaScripts to understand the JSON because you can execute the code, whatever the code you have created with the help of JSON, this code probably can be written in any language. So independent of any operating system, or whatever the programming language you are using to write this data format or whatever the platform or whatever the vendor you are using, it really doesn’t matter. So even if you change these types, still the code is kind of same even if you are using a different platform or different operating system. So which means you don’t need to re rewrite the code. The code remains the same. Probably that is what called as language independence.

3. JSON Data Types

Next thing we’ll try to understand the data types used in the JSON. As we discuss, the JSON is widely used data format for data exchange between the applications. Now there are multiple data types used which are generally used for representing the data. Like whatever you see here, the strings, numbers, objects, arrays, now boolean, probably these are all referred as data. So they exactly define how the data is actually represented between the applications. So let’s try to understand one by one. So the first one will start with strings. Now, the string represent any sequence of characters inserted in between double quotes. So it has to be written must be in double quotes. Like you can see the name written in double quotes here and again the name, whatever it is, like click under the name here. So a couple of other examples you can see here, like if you’re writing some, these are general examples I’m using. Like here you can see the color, it says purple or any other color.

The type of interface it is ethernet if name, what is the type name of the interface description. Like this is a little bit relevant to our Cisco networking. So I got some of the examples here as well. So anything you see in between the double quotes we call them as strings. It is a kind of character, a sequence or it can be any characters which are written in double quotes. On the next one we have something called Numbers members represents any decimal number, which can be like fraction or it can be a negative number like the integer numbers or the floats, which can be any number. The normal. Decimal number zero to nine. Or it can be minus like negative values also can be present or even it can be in terms of fractions, like 0. 5 point in the kind of fractions.

Now, how to identify them? So the difference is you can see these are some of the examples like age 20, what is the percentage this one. So if you compare these two, the difference is whatever. The answer is represented in double quotes if it is a string. But whereas here the answer is not in the double quotes. So that is how you can differentiate between the numbers and the strings. Now the strings has to be exact what is given in the double quotes. The numbers are like normal decimal numbers which are used generally to represent any information in the form of numbers. Now the next thing we have something called objects. Now objects are nothing but the combination of the string and the number values. Like previously we have seen a string, this is a string, like what is the department and then this is your number, right? So like that you have multiple combinations of strings. This is again another string and each string is again separated by comma. You can see here there is a comma which is going to separate each string and the combination of this is represented is called object.

So you can have multiple, maybe two, maybe three, maybe four. It can be any number and that’s what we call it as a set or a combination of multiple pages. Multiple page means nothing but the combination of these two. We call them as pace, string or member values. Typically these are closed in flower brackets. You can see here, these are the flower brackets. Whatever is enclosed in between the flower brackets, we call them as a specific object. So you can have one or more values inside one object. Like this is another example. And if you try to see this one, this is again another object starts from here and it’s ends on this. And there are multiple values or multiple strings or multiple numbers inside the object. Like this is another example. Now likewise we have another data type called erase. Now errors represent a group of values or we can say the collection of values which are generally identified here. Like if you take an example like the h, it can be any value which is represented in this square brackets.

So it can be like five or eight or nine or ten or any maybe on or n, maybe one or two values matches. So it always begin with the square brackets, okay? So the value array will be separated by comma means each value inside the array will be separated by comma. So this is what we call as array. So array is like the same. Like multiple values are used inside this one which are separated by commas inside the square brackets separated by commas, which matches any one or more than one value which are given inside the square brackets. A similar way we have something called boolean.

Probably this is another type of data type which is going to tell whether true or false. Like if the result is true or false, it’s going to match either zero or one. Like some other coding you have something like one is like true, zero is like false if you’re using some other formats. So you have only two values, either it is true or false. If it is true, then you can just say go and do this. If it is false, then you can say, okay, then you just go and do this. Similarly, there is something called null. Null represents no value, which is like if it’s like don’t give any value, it’s like no, undefined. We can say in some other terminology we call as undefined value or not defined value. Nothing is defined, I know nothing is assigned in general.

4. JSON Syntax Rules

The next thing we’ll try to see some of the rules we need to keep in mind while writing the JSON data code. Like the same thing what we have seen. So whatever the key value pace, that has to be grouped with something called colon. Now key value pace means whether you’re writing other strings. Like here you can see these are the couple of examples with strings. You can see there is a colon in between or whether you’re writing any specific numbers.

So there is a colon which is going to represent between them. So we call them as key value pace. Now the key value pace are grouped with a colon. That is the first thing you need to remember. And the multiple page, if you’re writing multiple page within the object that has to be separated by commas, like we have seen anything enclosed in between these flower brackets probably we call them as object. And in that object we can have either a single, maybe a single string or single number. Or you can have multiple. Like here in this example you can see this is the first one and then we have a second option and then we have this third one and then we have this fourth one. So when you have four key value pairs, now each and every key value pair should be separated by a comma comma.

And then you can use space or you can use Enter. So probably whenever you’re using Enter it comes in the next line. So basically these two are the same thing. So whether you will see the format, either this one or this one, both are exactly the same. So that’s what you can see the space or the line break, it doesn’t matter, they both represent the same thing which represents it most to the next key value pair. Okay, now if you’re writing anything in the square brackets that is a kind of errace. So we have seen the errors option. Now the arrays or the combination probably erase representative presents a group of values which can be identified identifying either one or more. Now they should be enclosed inside the square brackets and then separated by comma. So square brackets and then the calipers is as I said, it is going to represent the object. So these are some of the rules we need to keep in mind while writing the syntax rules.

5. JSON Data Interpretation

In this topic probably will see the steps inside the Puppet pull model. First, let me quickly review the basic differences between the pull model and the push model. Now we have seen that in the previous topics. In the pull model what happens is the device will have an agent and this agent is going to request the Puppet master and the server server or the master is going to send out the configuration information. So which is something used in the case of Puppet. So Puppet uses pull model where the agent is going to send out a request for the configurations. Of course a pull push model is something like used in some other software like ansible where the server is going to push the configurations initially. So the Puppet is going to use the pull model to make it configuration appear on the device.

And this process goes in four steps. So I’ll just quickly give an overview of these four steps. Now the first step is it is going to build the configuration files. Now the engineer, probably the engineer is going to server and is going to create something called configuration files. Configuration files. Technically we call it as a manifest here. So that has to be created. And if you already have some kind of confirmation files where you need to make some changes, probably you can go and create or you can just go and edit those confirmation files on the server or the Puppet master. So that is like the first step. And the second step is the agent. Now that agent have agent software installed, the end nodes. Now the engineer has to configure and enable the agent on this particular device. Option means this agent must be enabled or whatever the configurations or specific configurations you need to do. Probably you have to do it over there. So this is like first step and this is like second step. Just like, you know, you need to enable the agent. Agent has to be enabled in order to initiate the request. Because in the pull model as I said, the agent is going to initiate the request and that agent has to be configured or enabled with that option on each and every device. Now the third step is the agent is going to pull the manifest files. So in the third step the agent is going to send out a request to the master because in the pull model the agent is going to initiate the request. So agent is going to contact the server and then it’s going to ask for the details of the configuration files. So server is going to update the confirmation files. So probably the next thing is the server is going to send out a reply saying that okay, these are the confirmation files you need to apply and this is how the confirmation should look and this is what you need to apply. And finally this is how it should look. Probably after that, there will be something like the the last step. Now, agent is going to pull the conflicts additional configurations, if required, from the server. So if the agent need to be updated, more updates because the configuration files is not exactly, let’s say whatever the configurations need to be present. And to make that possible, it needs some more detailed information or some more options. So probably it is going to do some additional pools or additional requests to the server to get all the configurations in detail and update the device configuration. So this is how at the back end it works. So it uses pool model. And this pool model goes in four different steps. Beta.

Comments
* The most recent comment are at the top

Interesting posts

The Growing Demand for IT Certifications in the Fintech Industry

The fintech industry is experiencing an unprecedented boom, driven by the relentless pace of technological innovation and the increasing integration of financial services with digital platforms. As the lines between finance and technology blur, the need for highly skilled professionals who can navigate both worlds is greater than ever. One of the most effective ways… Read More »

CompTIA Security+ vs. CEH: Entry-Level Cybersecurity Certifications Compared

In today’s digital world, cybersecurity is no longer just a technical concern; it’s a critical business priority. With cyber threats evolving rapidly, organizations of all sizes are seeking skilled professionals to protect their digital assets. For those looking to break into the cybersecurity field, earning a certification is a great way to validate your skills… Read More »

The Evolving Role of ITIL: What’s New in ITIL 4 Managing Professional Transition Exam?

If you’ve been in the IT service management (ITSM) world for a while, you’ve probably heard of ITIL – the framework that’s been guiding IT professionals in delivering high-quality services for decades. The Information Technology Infrastructure Library (ITIL) has evolved significantly over the years, and its latest iteration, ITIL 4, marks a substantial shift in… Read More »

SASE and Zero Trust: How New Security Architectures are Shaping Cisco’s CyberOps Certification

As cybersecurity threats become increasingly sophisticated and pervasive, traditional security models are proving inadequate for today’s complex digital environments. To address these challenges, modern security frameworks such as SASE (Secure Access Service Edge) and Zero Trust are revolutionizing how organizations protect their networks and data. Recognizing the shift towards these advanced security architectures, Cisco has… Read More »

CompTIA’s CASP+ (CAS-004) Gets Tougher: What’s New in Advanced Security Practitioner Certification?

The cybersecurity landscape is constantly evolving, and with it, the certifications that validate the expertise of security professionals must adapt to address new challenges and technologies. CompTIA’s CASP+ (CompTIA Advanced Security Practitioner) certification has long been a hallmark of advanced knowledge in cybersecurity, distinguishing those who are capable of designing, implementing, and managing enterprise-level security… Read More »

Azure DevOps Engineer Expert Certification: What’s Changed in the New AZ-400 Exam Blueprint?

The cloud landscape is evolving at a breakneck pace, and with it, the certifications that validate an IT professional’s skills. One such certification is the Microsoft Certified: DevOps Engineer Expert, which is validated through the AZ-400 exam. This exam has undergone significant changes to reflect the latest trends, tools, and methodologies in the DevOps world.… Read More »

img