What is JSON and how to use it
Welcome to another lesson on iLoveCodingorg. In this lesson, we are going to learn what JSON is; And when and why to use JSON.
As you know that JavaScript object is written in a particular format var obj = { };
and you start writing content in the curly braces. You can have object within an object or an array within an object like such
Douglas Crockford said that JavaScript objects have a special kind of format in which you can store information. He suggested that we should remove the first line of code, and data can be stored in that particular format as shown below
Before the word JSON was introduced, data on the internet would be carried in XML format which is also just text, organized in a HTML markup style.
Also the XML format has more characters, while JSON has less amount of characters. When it's transferred to the internet, the spaces are removed.
How JSON data is used practically on the internet
Open the chrome developer tools and go to twitter, and click on "view x amount of new tweets" go to the network tab, click on the type of data and go to the response tab. You can see the data in JSON format as shown below
If you want to learn more about JSON, there are a few videos on iLoveCoding.org. Watch the last three videos on AJAX in Learn JQuery in 14 days course. At the end of the videos, you will be able to create a few applications via the Google APIs.
I hope you enjoyed this lesson. If you have any question, leave your comments below. I'll talk to you in the next lesson. Good bye :)
Get Started
Already have an account? Please Login