The JSON to Java converter turns a sample JSON document into Java 17 records or classic POJO classes. Paste an API response and get typed Java source describing its shape, ready to drop into a Spring or Jackson project instead of hand-writing every field, constructor and getter.
Conversion runs entirely in your browser with no upload, so you can turn a real production payload into Java types without it ever leaving your machine. It is free and needs no account.
It is built for Java and Kotlin backend developers who consume JSON APIs and want accurate model classes fast, including the nested types, List generics and Jackson bindings they would otherwise write by hand.
Choose Records to emit compact Java 17 records — public record User(String id, ...) {} — or Classes to emit traditional POJOs with private final fields and public getters. Records suit immutable DTOs; classes suit codebases still on older Java or frameworks that expect getters.
Types are inferred from the sample values: strings become String, whole numbers become long, decimals become double, true/false become boolean, and a null or empty field becomes Object because the sample can't reveal its real type. Nested objects become their own named record or class referenced by the parent.
JSON arrays become List<X>, where X is inferred from the elements — List<String>, a named element record for arrays of objects, or List<Object> for empty or mixed arrays. java.util.List is imported automatically, and only when a List actually appears in the output.
With Jackson on, any JSON key that isn't a valid camelCase Java field — like first-name or user_id — gets an @JsonProperty("original-key") so deserialization still maps correctly. The com.fasterxml.jackson.annotation import is added only when at least one annotation is emitted, keeping clean payloads import-free.
Both. Pick Records for Java 17 immutable record types, or Classes for POJOs with private final fields and getters. Toggle the Style control to switch.
Whole numbers become long and numbers with a decimal point become double. Because a single sample can't prove the intended width, widen or narrow to int, Integer or BigDecimal by hand where you need to.
Only when Jackson annotations are on and a JSON key differs from the camelCase Java field name it maps to — for example first-name maps to a firstName field with @JsonProperty("first-name"). Keys that already match get no annotation.
Yes. Conversion runs entirely in your browser, so the JSON you paste is never uploaded or logged.
The sample didn't carry enough information — a null value, an empty array or an array of mixed types can't reveal a concrete Java type, so it falls back to Object. Provide a fuller example or refine the type by hand.