Thursday, February 14, 2008

RESTful JSON

In a recent project, I used a REST style interface(PHP) and GWT (Google Widget Toolkit). The first thought for a data exchange format was XML. However, on further rumination, the prospect of writing XML node iteration code was daunting. After having done the whole XML node iteration for multiple projects before this, I was feeling too lazy to do it all over again :). Thats when I thought of using JSON (Javascript Object Notation). The JSON programming model is much simpler to use than XML. The ease with which the data can be transformed into objects eliminates all the node iteration code. This is due to the multitude of libraries (including GWT) available for encoding/decoding the JSON format and the ease with which JSON can be converted to objects.  Finally, I ended up with a REST style interface returning JSON encoded data that gets decoded on the client by GWT. 

JSON seems to be a much simpler data exchange format while XML seems to more suited to storage of data. A good combination is probably an XML database (more flexible than an RDBMS) for storage and JSON for data exchange.

No comments:

Int size on Apple Watch (watchOS)

  Even though Apple Watch chipset is 64-bits, Int is still 32-bit. To get 64 bit behavior you have to explicitly use Int64 https:// jeffver...