Getting Started with Google GSON


ajduke's blog

In Java world,  JSON is becoming de facto standard for data exchange format over XML because of its ease of use and efficiency in terms of transferring it.

If you don’t know about JSON, it is Javascript object notation, a text based data exchange format which is collection of name-value where name is strictly of string type and value can be int, boolean, array or another json object.

GSON is open source Java library developed by Google. It is an API for converting a Java object to/from json representation.

Why should you use it ?

  • Converts any Java object i.e new object or any existing/legacy object, to JSON and vice-versa.
  • Finest support for generic objects
  • Simple, convenient methods for conversions
  • No need of any annotation for fields for conversions
  • All the fields by default are included in conversions even private fields
  • If don’t want to include the field in conversion…

View original post 500 more words