AgileApps Support Wiki Pre Release

JSON

From AgileApps Support Wiki
Revision as of 18:00, 17 April 2012 by imported>Aeric
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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