Add valid JSON
Paste an object or array, or open a local .json file. Nested structures and representative array records produce the best types.
Generate clean Java model classes from real JSON data. Infer nested objects, Lists, numeric types, nullable wrappers, and safe field names with optional getters and setters.
Generate reusable Java definitions in three focused steps.
Paste an object or array, or open a local .json file. Nested structures and representative array records produce the best types.
Name the root model, choose whether to include accessors, and let the converter infer nested Java field types.
Review the generated source, copy it into your project, or download a ready-to-use .java file.
The generator examines complete structures rather than guessing from the first property alone.
Objects inside objects receive clear named definitions instead of unreadable inline blocks.
JSON arrays become typed Java Lists, including Lists of generated nested model classes.
Invalid or reserved JSON property names receive safe fields with @JsonProperty annotations.
JSON parsing and type generation happen locally in your browser without a server upload.
Strings become String, whole numbers become Long, decimal numbers become Double, booleans become Boolean, arrays become typed List fields, and objects become nested model classes.
JSON keys may contain hyphens, spaces, reserved Java words, or leading numbers. The generator creates a valid field identifier and adds @JsonProperty so Jackson can still map the original key.
Generated classes describe the sample you provide. Include realistic array records and nullable values so field types reflect the API payload accurately.
// JSON { "id": 42, "name": "Alex", "roles": ["admin", "editor"] } // Java public class Root { private Long id; private String name; private List<String> roles; }
Practical details about inference, arrays, nulls, and generated definitions.
Yes. Nested objects become static nested Java classes, and arrays of objects become typed Lists of generated classes.
Object samples are merged so the generated element class includes fields found across the supplied records.
Known nullable fields use Java wrapper or reference types. A value that is only null in the sample becomes Object because its concrete type cannot be inferred.
Yes. Keep the accessor option selected to create public getter and setter methods for every generated field.
Yes. The generator sanitizes the Java field name and adds a Jackson @JsonProperty annotation with the original key.
An empty array provides no element evidence, so the field is generated as List<Object>.
No. Parsing, inference, copying, and downloading happen locally inside your browser.
Yes. The definitions describe the supplied sample. Compare them with your API contract, especially when optional or rare fields may be absent.