Gson is awesome in making conversion from JSON to Java classes easy for us developers. With a few lines of code, you can pass JSON and get fully-mapped Java objects back. However, one pain point of using Gson is setting up appropriate Java POJO classes. Creating a POJO class based on JSON is time-consuming and error-prone.
In this tutorial, you'll explore two options to automatically generate the POJO classes. The idea is straight-forward: simply paste an example JSON and get appropriate Java POJO classes back from the tool. Let's jump in!
Gson Series Overview
- Mapping of Enums
- Mapping of Circular References
- Custom Serialization for Simplification (Part 1)
- Changing the Default Serialization with Custom Serialization (Part 2)
- Custom Deserialization Basics
- Custom Instance Creator
- Customizing (De)Serialization via @JsonAdapter
- Custom Deserialization for Calculated Fields
- On-The-Fly-Parsing With Streams
- ProGuard Configuration