Java Google Json (Gson) Serializing Inner classes

Serializing inner classes

Gson can serialize inner classes and static nested classes. The detailed example below demonstrates the following things.

  1. Serializing class containing static nested class
  2. Serializing class containing non static nested class (Inner class)
  3. De-serializing json to a class containing static and non static inner class
  4. Serializing static nested class (without the enclosing type)
  5. Serializing non static nested class (without the enclosing type)
  6. De-serializing json to a static nested class (without the enclosing type)
  7. De-serializing json to a non static nested class (without the enclosing type)

The Example

The AlbumsWithInnerClass

2 thoughts on “Java Google Json (Gson) Serializing Inner classes

Leave a Reply

Your email address will not be published. Required fields are marked *