Heard the term JSON and wondered what it is ? Well you should be its growing up these days and at first it seems like it is just another framework like jquery or some library in javascript. But let me tell you its something you might want to use more often ๐Ÿ™‚

What does it stand for ?

JavaScript Oject Notation

What does it do ?

It is a collection of name value pairs, and is easily readable by human and machines. It is completely machine/language independent. It more like XML but is very different in syntax.

A snippet from JSON code

{"realin": {
 
"blog":[
 
{"name": "Your Tech Dose",
 
"url": "http://realin.co.in"
 
},
 
{"name": "Sachin Khosla",
 
"profession": "software engineer"
 
}],
 
"belongs":[
 
{"place":"Delhi/India",
 
"Status": "Citizen"
 
}]
 
}}

So you see you can easily understand what this is all about. If we extract the symbols then there are 4 basic symbols used in here Squiggles, Square,colons and comma

Squiggles ( { ) acts as container

Square ( [ ) as usual holds arrays

colons ( : ) seperates the name value pair

comma ( , ) seperates the array values

XML and JSON are they alike ?

Well i must say yes, and reason being :

  1. Both them are human readable and descriptive as in what they are.
  2. Both have a hierarchal descriptive order
  3. Both are language independent
  4. Both can be used with AJAX

Did someone say XML and JSON are different ?

XML have angular bracket representation like html

XML can be tedious, where as writing JSON is like a regular code writing

…. can’t think more of it for now ๐Ÿ˜›

Is it client or server side ?
PHP supports JSON extension and many other language too, you can find a list here

And ofcourse it is supported at client side

Here we end ..

So why you should choose JSON over XML, well i must say that JSON is quicker than XML because you avoid writing handwritten XML.

Cheers !!

Realin !

Share this post: