Java Json Tutorial – Full Java Json Example

The Java JSON Tutorial series focus on three popular third party Java libraries to process JSON data, which are Jackson, Google Gson and JSON.simple. JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.

Java Json Tutorial, Java Json Example
Source: JSON (JavaScript Object Notation)

JSON is built on two structures:

  • A collection of name/value pairs. In various languages, this is realized as an object, record, struct, dictionary, hash table, keyed list, or associative array.
  • An ordered list of values. In most languages, this is realized as an array, vector, list, or sequence.

Jackson
A High-performance JSON processor.

1st Java JSON Tutorial: Convert Java Object to/from JSON using JACKSON API
Java Json Example to use ObjectMapper writeValue() and readValue() to convert Java object to / from JSON.

2nd Java JSON Tutorial: Json Tree Model Example using Jackson API
Java Json Example to read/write JSON Tree using Tree Model

3rd Java JSON Tutorial: Jackson Json Streaming Example
Java Json Example to use JsonGenerator() and JsonParser() to stream read and write JSON data.

4th Java JSON Tutorial: Jackson Json Annotation Example
Java Json Example to use Jackson Json Annotation

5th JSON Tutorial: Pretty print JSON in Java
Java Json Example to use ObjectMapper to pretty print JSON.

Google Gson
Gson (also known as Google Gson) is an open source Java library to serialize and deserialize Java objects to (and from) JSON. It was originally created for use inside Google, now it is used by many public projects.

1st Java JSON Tutorial: Convert Java collections into JSON and JSON to collections
Java Json Example to use toJson() and fromJson() to convert Java Object to / from JSON.

2nd Java JSON Tutorial: Parse json string and java object into Gson tree model
Java Json Example to use JsonParser and GsonBuilder to create Gson tree model

3rd Java JSON Tutorial: Read & write file using Gson streaming
Java Json Example to use JsonWriter() and JsonReader () to stream read and write JSON data.

4th Java JSON Tutorial: GSON Annotations Example
Java Json Example to use GSON annotation

5th JSON Tutorial: GSON Annotations Example using JsonAdapter
Java Json Example to use GSON annotation with JsonAdapter

6th JSON Tutorial: JSON pretty print using Gson
Example to use GsonBuilder to pretty print Json string

References
Introducing JSON
JSON described in RFC 4627
JSON Wiki
Jackson official website
Gson official website

Leave a Comment

*

Please share it if you found this useful
Hide Buttons