Hello, guys.
Good to see you back once again.
I'm back with a new tutorial and in this tutorial we are going to learn about Jason.
We are going to learn what is the usage of Jason and why should we learn?
Now let's try to understand what is the meaning of Jason.
Jason stands for JavaScript Object Notation, and if we talk about what is the usage of Jason, it is
used to store and exchange data.
Now you might confuse Jason is related to JavaScript.
No it is not.
It is not related to JavaScript.
But there is a reason that we use JavaScript in its name.
There is a thing in JavaScript which we call object literal, otherwise JavaScript object.
When Jason was created, it is pretty similar with JavaScript objects.
That is why it was known as JavaScript Object Notation.
And once again I'm going to told you JavaScript is not related to Jason.
It is only used for store and exchange data.
Now let's talk more about it whenever we create a website.
Otherwise web application its depend on two main thing.
First one is client and second one is server.
In your client site.
It could be anything I want to say, it could be a mobile, otherwise laptop, desktop, etcetera.
And whenever we need to exchange data and get the response at the current time otherwise too quickly,
then we use Json between them.
And as I told you, Json is not a language, it is data exchange format without Json.
We have another popular data format which is XML.
It is also used to exchange data, but as compared to XML, Json is more popular and reliable.
But you might have question why Jason is more popular.
And to understand it, first we need to talk about their syntax.
If I talk about Json format, its look like in JavaScript object.
In JavaScript objects we use curly braces and also we use key and value pair.
But XML is different.
This is the XML data format.
Here we need to use tag like HTML to contain data.
As you can see for their name we use name tag for age, we use tag and for the object here we use student
tag.
And there are a lot of difference between Json and XML.
So let's see the difference between Json and XML.
First they are full from Json stands for JavaScript Object Notation, but XML stands for Extensible
Markup Language.
It is a language, but Json is not a language.
The next different is Json based on text format, but XML based on markup language.
It is quite similar with HTML and it takes time to learn XML, but you can understand Json within 10
to 20 minutes.
Next point is Json is lightweight but XML is heavier.
That's why Json is more popular than XML.
Tags and properties make XML very heavier, but the benefit is XML support comments and namespace but
Json do not support comments and namespace.
Now let's see the difference between Json and JavaScript object.
As we know, Json is pretty similar to JavaScript object, but not the same as exact JavaScript object.
So first I'm going to show you the JavaScript object.
When we create a JavaScript object, first we need to declare a variable name.
Also, we need to use curly braces to create an object.
And inside this curly braces we take key.
Otherwise we can call it property and value at the same way.
To create a Json object here we need to use curly braces.
But the difference is we should take property name inside the double quotes every time.
And also we need to take double quotes for our value.
But if I talk about JavaScript object, we don't need to use double quotation for property name.
Also, we can take single quotes for value, but we cannot use single quotes whenever we create Json
object.
And if you want to print a Json object or a JavaScript object, nearly we need to follow the same method.
Now let's talk about what kind of data type Json support Json support, string, data type, number,
data type, boolean, data type, array object, and NULL.
If we want to send empty value, then we use null data type.
Otherwise, if you forgot to pass a value, then by default it is going to send null.
And to understand all the values here I create an example.
At first, as I told you, we need to take curly braces.
Then inside the curly braces here we set our first property which is ID and as I told you, we need
to use double quotes to take.
The property name.
Then here we use number data type.
That's why we do not use any double quotes.
Our next property is name, but for name here I use string data type.
That's why we need to take it in a double quotes.
And for married here I use boolean data type.
That's why here I take true value.
And for boolean value we don't need to use any double quotes.
If you use boolean data type here, you can pass true otherwise false value.
But at the next example, as you can see here, we do not send any data.
So by default it's going to set null value.
And for this hobby property here I use array value.
That's why I use square braces.
And inside the square braces we take the values.
And for an address here we use object datatype.
It is an object.
That's why again we take curly braces.
But if you notice for our next property vehicle here we take multiple object value inside this object.
Here we take multiple objects and it's called nested objects.
So these are the data types that we can use in Json.
Now let's talk about the advantages of Json.
Jason came with human readable format.
Anyone can easily understand Json if anyone not come from any programming language background.
Also he can understand Json and the next advantage is it is completely language independent.
We can use Json with every programming languages like Python, PHP, JavaScript, Kotlin, Java, whatever,
whatever language you use.
And also Json is very lightweight to use.
We send data to server to client in a Json format.
Json played a big role in Ajax.
Also rest API.
Otherwise any APIs.
That's why Json is so important.
But there is one big disadvantage of Json.
We cannot transfer any media file as Json format.
We cannot transfer audio, video, images or any binary information.
Here we can pass only text based information.
And here is another important thing that we are going to learn about in our practical session.
So this is it for this tutorial.
In the next tutorial I'm going to start the practical about Json.
So thanks for watching this video.
Stay tuned.