JSON to Java Class
Paste JSON and get Java classes: plain POJOs with getters and setters, Lombok classes or records.
How to use the JSON to Java Converter
- Paste JSONPaste an API response or any JSON object, or open a .json file.
- Pick a stylePlain classes with getters and setters, shorter Lombok classes, or immutable records. Jackson annotations keep keys that are not camelCase.
- Copy the classesPut each public class in its own .java file, or make the nested ones static inner classes.
Example
"is_active": true becomes @JsonProperty("is_active") private boolean isActive; with isActive() and setActive().
The sample gives 4 classes. "orders" becomes List<Order> orders, and the nullable coupon stays a String.
Frequently asked questions
Why are some numbers Long instead of long?
Fields that are null or missing in the sample use wrapper types (Long, Double, Boolean) so they can hold null. Fields always present use primitives.
Do I need Jackson?
Only for keys that are not valid camelCase Java names, such as is_active or keys with dashes. Turn the option off if your JSON keys already match.
Which style should I use?
Records are short and immutable but need Java 16+. Lombok needs the Lombok library. Plain POJOs work everywhere, including older Android projects.