ADVERTISEMENT

What is JSON In JavaScript ? JSON Explained

Telegram Group Join Now

ADVERTISEMENT

What is JSON In JavaScript ? JSON Explained

What is JSON In JavaScript ? JSON Explained
What is JSON In JavaScript ? JSON Explained

Introduction What is JSON 

JSON actually stands for JavaScript Object Notation and functions well as a simple format to store or transport data. JSON was founded by Douglas Crockford in 2013 for the purpose to store or transport data.

ADVERTISEMENT

ADVERTISEMENT

Usage Of JSON

JSON is used to send data from a server (backend) to a web page (frontend). JSON is considered self-describing as it’s very easy to write or read JSON. JSON is considered a string with a certain data format (text format) as it can only contain properties and not methods.

ADVERTISEMENT

Example

ADVERTISEMENT

Let’s see an example use case.

'{"name":"Lorem", "age":24, "house":null}'

This is an example JSON string that defines an object with a total of three properties that include name, age, and house. Each of these properties is given values in this case it’s Lorem, 24, and null.

Portfolio Website using HTML and CSS (Source Code)

ADVERTISEMENT

Later on, we may parse this JSON string with a JavaScript code, you can access these data as an object with:

let personName = obj.name;
let personAge = obj.age;

Storing Data

Storing Data needs to be in a specified format. Regardless of where you decide to store it, the text is the legal format. JSON helps by making it possible to store JavaScript objects in the form of text.

ADVERTISEMENT

Why should you use JSON?

ADVERTISEMENT

The JSON format is similar to JavaScript code in terms of syntax. Furthermore, since the JSON format is text, the data in JSON can be easily sent between computers and used in any programming language.

100+ JavaScript Projects With Source Code ( Beginners to Advanced)

Besides that, since the format supported is text only, JSON data can be easily transferred between computers. This means JavaScript has a feature where it can easily convert JSON to JavaScript objects via the following:

JSON.parse()

And that’s it! You have now successfully learned what is JSON!

written by @codingporium

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT

Telegram Group Join Now

Share on:

Leave a Comment

ADVERTISEMENT

ADVERTISEMENT

ADVERTISEMENT