Configuration
Basic Usage
Convert your JSON objects into Java Bean classes with proper getters, setters, and optional Lombok support.
Basic Steps
- Enter your JSON in the input field or use the Load Example button
- Configure package name, class name, and Lombok settings
- Click 'Generate Java Bean' to create the Java class
- Copy the generated code for your use
JSON to Java type mapping
Types are inferred from the values in your sample, not from a schema, so the generated class is only as accurate as the JSON you paste. Provide a representative document — one with every optional field populated — and check the mapping below against your domain model.
| JSON value | Java type | Notes |
|---|---|---|
| "hello" | String | The default for any quoted value that is not recognised as a date. |
| "2024-01-01T00:00:00Z" | LocalDateTime | Strings matching the ISO 8601 pattern are mapped to LocalDateTime. Epoch timestamps arrive as numbers and become Integer or Double instead. |
| 30 | Integer | Whole numbers become Integer. Values beyond the 32-bit range need changing to Long by hand. |
| 95.5 | Double | Any number with a fractional part becomes Double. Use BigDecimal for money — Double is not safe for currency arithmetic. |
| true | Boolean | Wrapper types are used throughout so that a missing field can be null rather than silently defaulting to false. |
| ["a", "b"] | List<String> | The element type is inferred from the first item. Mixed-type arrays fall back to List<Object>, and an empty array cannot be inferred at all. |
| { ... } | NestedClass | Each nested object becomes a static inner class named after its field. |
| null | Object | A null value carries no type information, so Object is emitted. Replace it once you know the intended type. |
Nested objects and collections
Nested structures are turned into static inner classes named after the field that contains them, so a single paste produces a complete, compilable file rather than a flat class with Object fields.
Input JSON:
{
"id": 41,
"customer": { "name": "Ada", "email": "ada@example.com" },
"items": [{ "sku": "A-1", "qty": 2 }]
}Generated class:
public class Order {
private Integer id;
private Customer customer;
private List<Items> items;
public static class Customer {
private String name;
private String email;
}
public static class Items {
private String sku;
private Integer qty;
}
}How names and collections are resolved
- An inner class is named after its field, with the first letter capitalised — a customer field produces a Customer class.
- An array of objects produces List<T>, where T is an inner class generated from the first element.
- Nesting is followed to any depth; each level adds another inner class.
- Two fields with the same name at different levels resolve to the same class name, so rename one if their shapes differ.
- An empty array yields List<Object> because there is no element to infer from — supply a populated sample instead.
Features
Available Features
- Optional Lombok integration (@Data, @NoArgsConstructor, @AllArgsConstructor)
- Smart type inference for JSON values
- Support for nested objects and arrays
- Proper code formatting and imports
- JSON validation and error checking
Tips & Best Practices
Usage Tips
- Validate your JSON before generating the class
- Use Lombok to reduce boilerplate code
- Use meaningful class names that reflect the data structure
- Follow Java package naming conventions (e.g., com.example.model)
- For complex types, consider generating multiple classes
Note: The converter generates standard Java Bean classes with proper encapsulation. Lombok annotations can significantly reduce the amount of boilerplate code.