Difference between revisions of "JSON"
imported>Aeric (Created page with "JSON provides a convenient data-interchange format, typically used over an HttpConnection. __TOC__ ==About JSON== JSON (JavaScript Object Notation) uses JavaScript syntax to …") |
imported>Aeric |
||
Line 1: | Line 1: | ||
JSON provides a convenient data-interchange format, typically used over an [[HttpConnection]]. | JSON provides a convenient data-interchange format, typically used over an [[HttpConnection Class|HttpConnection]]. | ||
__TOC__ | __TOC__ | ||
==About JSON== | ==About JSON== |
Latest revision as of 18:00, 17 April 2012
JSON provides a convenient data-interchange format, typically used over an HttpConnection.
About JSON
JSON (JavaScript Object Notation) uses JavaScript syntax to encode nested data. It is a common format for data-interchange on the web, because it is easily parsed by the JavaScript engine (which is typically already running in the client and server), and because it uses fewer characters than XML to encode the same data.
For example, XML encloses data in open and close tags: <someElement>...</someElement>, while JSON uses opening and closing braces: someElement{ ... }. With deeply nested data, the resulting structures can be harder for a human to read, but computers have no trouble with it. And for simple data, one is just about as easy to read as the other.
There are some situations that XML handles more readily, like embedded character data (CDATA) and tag namespaces, but JSON excels in the most common data-interchange scenario, where every data element is simply a string, even when the data elements are deeply nested.
JSON APIs
The JSON libraries are built into the platform, and can be accessed from any Java code you write. The available APIs are documented at JSON.org