SHARE

What Is JSON

JSON stands for javascript object notation . JSON is part of javascript . It is an new format to design JavaScript in very light weight manner . JSON is built into javascript programming language .

javascript object notation is used to read data from a web server , and display this data on a web page.

It is very simple to understand and handle to read cross server data and display on the page this is the reason JSON is best alternative of XML language .

It is self describing language . So you can easily understand this .

JSON
JSON

Example

var obj1 = {user:"manu",age:35, business:"blogging"};

You can define your own variable names , keys and values . In this example user , age and business is key that is defined by the javascript object notation programmers . So It is an independent language .

Basic Difference from Javascript

JSON uses all JavaScript syntax , but the JSON format is only text format . This text can be read and used by any othe programming language .

An Complete JSON Code Example

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var obj1 = {user:"manu",age:35, business:"blogging"};
var obj2 = {user:"john",age:50, business:"job"};
var obj3 = {user:"tom",age:17, business:"manufacturer"};
var obj4 = {u1:obj1,ul2:obj2,ul3:obj3};
document.write(obj2.user);
</script>
</head>
<body>
</body>
</html>

Test This Code

In this example obj1, obj2, obj3, obj4 are four object that are created in JSON . user , age and business is key of created objects and manu , 35  and blogging etc are the values of the defined keys .

 

Json is very popular data interchange language even than XML .