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

One thought on “Java Google Json (Gson) Serializing Inner classes

  • October 28, 2016 at 1:49 pm
    Permalink

    Thank you, very helpful.

    Reply

Leave a Reply

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