JSON to Java
Generate Java POJOs or records from JSON, with Jackson or Gson annotations
How to use
- Paste a JSON object (or an array of objects) into the input pane.
- Choose POJO (getters/setters) or record style for the generated classes.
- Pick an annotation library: Jackson, Gson, or none.
- Copy the generated classes into your project; nested objects become separate classes.
About this tool
Hand-writing POJOs for a 20-field API response is 20 minutes of copy-paste typos waiting to happen. This generator does the mechanical part: Pascal-casing class names, camel-casing fields, adding @JsonProperty/@SerializedName where the JSON name differs, and choosing wrapper types for nullable fields. The record mode targets Java 16+ projects that model immutable DTOs.
Frequently asked questions
How are nested objects handled?
Each nested object becomes its own class. Class names derive from the parent field name (e.g. address becomes Address), and arrays generate a List<ElementSingularName> field.
Why are some numbers Long/Double and others long/double?
Fields that are absent in at least one row or explicitly null somewhere map to the wrapper types (Long, Double) so they can hold null. Fields present in every row use primitives.
What about fields with mixed types across rows?
When the same key holds different types in different array elements, the tool widens to Object and adds a comment. Consider normalizing your data or using JsonNode for those fields.
Is my data uploaded anywhere?
No. Everything runs locally in your browser — your JSON never leaves your machine.