J↓JSON → Java POJO
A POJO (Plain Old Java Object) is a simple Java class not tied to any specific framework. The DTO/VO pattern for mapping REST API requests and responses to Java classes is extremely common in Spring Boot and other Java backends. Writing these classes by hand from a JSON payload is tedious and error-prone. This tool automatically generates Java classes from JSON, incorporating your choice of Lombok annotations, Jackson property bindings, and nested class hierarchies.
How to Use
- 1Paste JSON
Paste the JSON you want to convert on the left. Nested objects and arrays are handled automatically.
- 2Configure Options
Set the root class name, package name, Lombok style (@Data, @Getter/@Setter, @Builder, or plain getters/setters), and @JsonProperty mode.
- 3Copy Result
Review the generated Java code on the right and click the copy button to paste it into your IDE.
Tips
- 💡Nested JSON objects are automatically converted to static inner classes.
- 💡@JsonProperty is added automatically when the JSON key and Java field name differ (e.g., snake_case → camelCase).
- 💡Lombok @Data generates getters, setters, equals, hashCode, and toString in one annotation.
- 💡Paste an API response JSON directly to quickly scaffold a ResponseDTO class.
FAQ
- Q. Which Java JSON libraries work with the generated classes?
- A. The generated classes include annotations for Jackson (@JsonProperty) and Gson (@SerializedName). Jackson is the most popular and is used by Spring Boot by default.
- Q. How are nested JSON objects handled?
- A. Nested objects are converted to inner classes or separate class files. Arrays are converted to List<T> where T is the inferred element type.
- Q. What happens with null values in the JSON?
- A. Fields with null values are typed as Object or marked with @Nullable. You should review and refine the types manually based on your actual data schema.