Hi Deepika,
Derived from JavaScript scripting language,
JSON is a lightweight text-based open standard designed for human-readable data interchange. It is used to represent simple data structures and associative arrays (objects). It is language independent and have parsers available for many programming languages. It's filename extension is
.json and MIME type is "
application/json".
Refer to this site to gain a deeper idea about how it works and how to use it:
http://www.copterlabs.com/blog/json-what-it-is-how-it-works-how-to-use-it/
You'll get many examples on above mentioned site.
Now, to answer your second question:
1. JSON requires less tags than XML – XML items must be wrapped in open and close tags whereas JSON you just name the tag once
2. Because JSON is transportation-independent, you can just bypass the XMLHttpRequest object for getting your data.
3. JavaScript is not just data – you can also put methods and all sorts of goodies in JSON format.
4. JSON is better at helping procedural decisions in your JavaScript based on objects and their values (or methods).
You can get JSON data from anywhere, not just your own domain. There's no more proxy server nonsense.
Hope it satisfies your questions :)
Mark it as answer if it helps.
Cheers!