GSON - Java to JSON serialization and vice versa

 If you need java to JSON lightweight serializer - take GSON.

http://code.google.com/p/google-gson/

 

Example:

class BagOfPrimitives {
  private int value1 = 1;
 
  private String value2 = "abc";
  private transient int value3 = 3;

  BagOfPrimitives() {
  }
}

(Serialization)
BagOfPrimitives obj = new BagOfPrimitives();
Gson gson = new Gson();
String json = gson.toJson(obj);  
==> json is {"value1":1,"value2":"abc"}
 

 

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at info@tikalk.com