Like XML, it is human-readable, platform independent, and enjoys a wide availability of implementations.
Data formatted according to the JSON standard is lightweight and can be parsed by Java Script implementations with incredible ease, making it an ideal data exchange format for Ajax web applications.
Since it is primarily a data format, JSON is not limited to just Ajax web applications, and can be used in virtually any scenario where applications need to exchange or store structured information as text.
For example, SOAP-based web services format the data in an XML payload wrapped within a SOAP envelope.
While XML works well for many application scenarios, it has some drawbacks that make it less than ideal for others.
One such space where XML is often less than ideal is with Ajax-style web applications.
Atif Aziz, Scott Mitchell February 2007 Applies to: JSON Ajax Summary: This article discusses Java Script Object Notation (or JSON), an open and text-based data exchange format, that provides a standardized data exchange format better suited for Ajax-style web applications.
(22 printed pages) Introduction Understanding Literal Notation in Java Script Comparing JSON to XML Creating and Parsing JSON Messages with Java Script Working with JSON in the .
NET Framework Conclusion References Download the source code for this article.
When designing an application that will communicate with a remote computer, a data format and exchange protocol must be selected.
Ajax is a technique used for building interactive web applications that provide a snappier user experience through the use of out-of-band, lightweight calls to the web server in lieu of full-page postbacks.
These asynchronous calls are initiated on the client using Java Script and involve formatting data, sending it to a web server, and parsing and working with the returned data.
While most browsers can construct, send, and parse XML, Java Script Object Notation (or JSON) provides a standardized data exchange format that is better-suited for Ajax-style web applications.
JSON is an open, text-based data exchange format (see RFC 4627).