JSON to Java POJO converter
Paste JSON and get Java classes. Nested objects become their own classes, arrays become List<T>, and snake_case keys become camelCase fields.
Turning an API response into Java classes
When you consume a REST API from Spring Boot, you need Java types that Jackson can deserialize the response into. Writing them by hand is repetitive: every field, every nested object, every list. This tool reads a sample JSON document and produces the classes for you.
- Nested objects become separate classes named after their keys, with plural list names singularised (
ordersbecomesOrder). - Keys that are not valid Java identifiers, or are reserved words such as
class, are renamed safely. - Java allows one public type per file, so save each generated class in its own
.javafile.
Nothing is uploaded. The conversion runs entirely in your browser, so it is safe to paste real payloads.
Frequently asked questions
Should I use a POJO, Lombok or a record?
Records (Java 16+) are the shortest and immutable, and Jackson supports them from 2.12. Lombok @Data is common in older Spring Boot codebases. Plain getters and setters need no dependencies.
Why does the tool add @JsonProperty?
When a JSON key such as user_name differs from the Java field userName, Jackson needs the annotation to map them in both directions.
How does it choose Integer, Long or Double?
Whole numbers become Integer, or Long if they exceed the int range. Numbers with a decimal point become Double. Use BigDecimal by hand for money.
What happens with arrays of objects?
Fields from every element are merged into one class, so a field present in only some elements still appears.