JSON to Java Classes
Generate Java POJOs from JSON with Jackson annotations, getters, and setters.
Conversion payloads stay in this browser tab and are never placed in page URLs - see how local processing works. Privacy-safe analytics record only the tool, outcome, and a coarse input-size bucket. Press Cmd/Ctrl + Enter to convert.
How to Generate Java Classes from JSON
Paste a representative response and the generator emits one class per object shape with Jackson annotations, private fields, and accessors. Split the classes into their own files following your package layout, then verify nullability and numeric widths against the API's documented contract.
Type Mapping
How each JSON type is inferred.
| Input | Output | Note |
|---|---|---|
| 42 | Integer | Whole number in int range |
| 9999999999 | Long | Exceeds int |
| 8421.5 | Double | Fractional |
| true | Boolean | Boolean |
| ["a","b"] | List<String> | Uniform array |
| null | Object | Type unknown from sample |
Frequently Asked Questions
Which JSON library do the classes target?
Jackson. Every field carries @JsonProperty("...") with the original JSON key, so camelCase Java fields map correctly onto snake_case or dotted payload keys without a global naming strategy.
Why boxed types instead of primitives?
Integer, Long, Double, and Boolean can hold null; int and boolean cannot. Since an absent or null JSON field is normal in API responses, boxed types avoid a NullPointerException at deserialization time.
Are getters and setters generated?
Yes, for every field, which is what Jackson's default bean introspection expects. If your project uses Lombok, delete the accessors and add @Data to the class.
How are nested objects named?
Each nested object becomes its own class named from its parent class and key, so two unrelated nested objects that happen to share a key name do not collide.