Posts

Showing posts from February, 2009

Consuming a JSON response in Android

Widely hailed as the successor to XML in the browser, JSON (JavaScript Object Notation) aspires to be nothing more than a simple and elegant data format for the exchange of information. JSON's basic types are: * Number (integer, real or floating point) * String (double-quoted Unicode with backslash escaping) * Boolean (true and false) * Array (an ordered sequence of values, comma-separated and enclosed in square brackets) * Object (collection of key: value pairs, comma-separated and enclosed in curly braces) * null This article gives an insight about how to use JSON as a data interchange format, provided with the URL of a Restful Service which returns a JSON response. Advantages of JSON * Simpler than XML because it is not a markup language and a natural representation of data * JSON is better data exchange format; XML is a better document exchange format * JSON is easier to read for machines with no/thin client-side library * JSON is a natural fit