What is JSON? why we Use JSON?


 In this article, we will discuss JSON we will see what is JSON, How do JSON works, How to use JSON, Advantages of using JSON. So let's have a look at what is JSON.

What is JSON?

JSON stands for Javascript Object Notation. Many people are actually mistaken around JSON that JSON is actually a sub-part of JAvascript. However, that is certainly not real. It is actually utilized to send out the information to the web server as well as get the information coming from the webserver.

How Does JSON Work?

When our team sends out the information to the web server such as a specific foreign language like Javascript as well as our team are actually utilizing a PHP or even python or even c# as a backend web server foreign language to carry out the job on this information, therefore, it is actually difficult to decode the javascript encoded information for the various other foreign languages. 

Our team has to utilize the JSON since every program's foreign language can easily quickly comprehend the style of JSON as well as quickly decode it as carrying out the job and after that inscribe the reaction into the type of JSON send out it to the frontend.

In Easy Phrases, our team can easily state JSON jobs as an intermediator or even translator in between various program languages.

How To Use JSON?

JSON is actually extremely simple to discover JSON. It observes the key-value set framework. It like Javascript Protest our team gonna talk about the syntex of some languages to inscribe as well as decode the JSON style. every program foreign language sustains the JSON Framework however it has actually a various label For instance In Python, this framework is actually referred to as a Dictionary.
 
In Python, the format of JSON is actually called a dictionary which can be exchangeable in JSON the syntex of Python seem like.
Syntex :

bike = {
  "brand""Royel enfield",
  "model""intercepter 650",
  "year": 2021
}

Now let's see How to convert a Python dictionary to JSON?

In Python, there is a method that is used to convert a dictionary into JSON. You can use json.dumps() to convert the python dictionary into JSON. 

In order to convert the JSON into a python dictionary, you can use json.loads() method.This method returns a dictionary. To get a dictionary Pass the JSON data variable into the json.loads() function or method so that you can read the data.

But remember one thing before using this function json. dump() and json.loads() you have to import the JSON method into your python program. 

In PHP, the format of JSON is actually called an Associative Array which can be exchangeable in JSON the syntex of PHP seem like

Syntex :

$bike = array("brand"=>"Royel enfield",
              "Model"=>"intercepter 650", 
              "year"=>2021);



 

Comments