Java-JSON

JSON (JavaScript Object Notation) is a lightweight data-text format. It's easy for humans to read or write. And even easier for machines to read/parse or create. JSON is completely language independent. Which means that every programming language can use JSON. Couple of reasons that you should prefer using JSON over XML is: ul liJSON is smaller than a href="http://camelcode.org/overview/Java-XML-tutorials.htm"XML/a/li liJSON is easier than a href="http://camelcode.org/overview/Java-XML-tutorials.htm"XML/a/li liJSON is faster than a href="http://camelcode.org/overview/Java-XML-tutorials.htm"XML/a/li liJSON doesn't need to be validated/li /ul




Google Gson


Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of.

arrow-right   Exclude fields from JSON using Gson with @Expose
     How to exclude fields for Serialization/Desirialization with @Expose

arrow-right   Custom JSON field naming with Gson
     Give your JSON fields custom naming

arrow-right   Write json file using GSON
     How to write an Object to JSON using GSON

arrow-right   Read json file with GSON
     How to parse json with Google GSON

arrow-right   Serialize Object with null values using GSON
     How to serialize null values using Gson.

arrow-right   Pretty printing JSON String with Gson
     How to print your JSON String pretty

arrow-right   Exclude fields from JSON with java modifiers using Gson
     how to exclude fields with java modifiers


JSONSerializer examples


JSONSerializer can transform any java object to JSON notation and back with a simple and clean interface, leveraging all the builders in JSONObject and JSONArray.

arrow-right   From JSON to XML
     How to convert JSON String to XML

arrow-right   From Java to JSON
     How to convert Java to Json string

arrow-right   From JSON to Java
     How to a JSON String to Java Objects

arrow-right   From XML to JSON
     How to convert XML to a JSON Object