Java class will appear here
Paste JSON and click Generate// generate java model classes from json in one click
Convert JSON to Java model classes instantly. Generate POJO, Lombok, or record classes with proper field types, getters, setters, and constructors.
Java class will appear here
Paste JSON and click GeneratePaste your JSON object or array into the input area on the left.
Set class name, optional package, and output style (POJO, Lombok, Record).
Click Generate, then copy each class. Nested objects become separate classes.
This tool reads a JSON object and generates a ready-to-use Java class with correctly typed fields. It detects String, int, double, boolean, List, and nested object types automatically. Nested JSON objects are turned into separate named classes.
The tool maps JSON types to Java types: JSON strings become String, integers become int, decimals become double, booleans become boolean, arrays become List<T>, and nested objects become separate named classes.
POJO generates a plain Java class with constructors, getters, and setters. Lombok adds @Data, @NoArgsConstructor, and @AllArgsConstructor annotations so you don't need to write boilerplate. Java Record (Java 14+) generates an immutable record class — the most concise option.
Yes. Any nested JSON object is converted into a separate Java class with the field name as the class name (camelCase to PascalCase). You can then include both classes in your project.
Yes. For REST APIs, the POJO or Lombok styles work out of the box with Jackson (the default Spring Boot JSON library). For immutable DTOs, use the Record style with Spring Boot 3+.
If the root is an array, the tool uses the first element to infer the class structure. This works well for typical API response arrays where all items share the same schema.
Keys are converted to camelCase Java field names. Underscores, hyphens, and spaces act as word separators. For example, first_name becomes firstName and user-id becomes userId.
No. Everything runs in your browser. Your JSON never leaves your machine — there is no server-side storage of any input or output.
Currently the tool generates List<T> for arrays. Map types and other generic containers are represented as Object for null values. More complex generics would require manual adjustment after generation.
Writing Java model classes by hand is one of the most repetitive tasks a backend developer faces. Every time you integrate a new API or define a new data structure, you end up creating a class, declaring private fields with the right types, writing a no-arg constructor, an all-args constructor, a getter and setter for every single field — and then doing it all over again for every nested object. This JSON to Java Class generator eliminates that entire workflow in one click.
Paste your JSON, choose your output style, and get a ready-to-compile Java class with correctly typed fields, properly named in camelCase, with all the boilerplate you'd normally write by hand.
💡 Looking for premium JavaScript plugins and scripts to accelerate your Java backend UI? MonsterONE offers unlimited downloads of templates, UI kits, and dev assets — worth checking out.
POJO stands for Plain Old Java Object. It's a simple Java class that has no dependencies on any framework — just private fields, a no-argument constructor, an all-arguments constructor, and public getter and setter methods for every field. POJOs are the standard model class pattern in enterprise Java development and are widely used with frameworks like Spring Boot, Hibernate, and Jackson for JSON serialization.
When you work with REST APIs in Java, you almost always need a POJO to represent the request body or response body. Tools like Jackson's ObjectMapper use the getter and setter naming conventions to map JSON keys to Java fields automatically. This tool generates exactly that kind of class, ready to use with Jackson's default configuration.
Project Lombok is a popular Java library that generates boilerplate code at compile time using annotations. Instead of writing explicit getters, setters, and constructors, you annotate your class and Lombok generates everything automatically during compilation.
With the Lombok output style, this tool generates a class annotated with @Data (which combines @Getter, @Setter, @ToString, @EqualsAndHashCode), @NoArgsConstructor, and @AllArgsConstructor. To use Lombok, you need to add it as a dependency in your pom.xml (Maven) or build.gradle (Gradle) and install the Lombok plugin in IntelliJ IDEA or Eclipse.
Lombok is widely used in Spring Boot projects because it dramatically reduces class verbosity. A 50-line POJO with five fields becomes a clean 10-line annotated class. The generated code is functionally identical — just much easier to read and maintain.
Java 14 introduced Records as a preview feature, and they became a standard feature in Java 16. A record is a special kind of class designed for holding immutable data. It automatically provides a canonical constructor, accessors for all fields (using field names without the get prefix), equals(), hashCode(), and toString() — all with zero boilerplate.
Records are ideal for DTOs (Data Transfer Objects) in read-only scenarios, such as representing API responses that you only need to read and pass around, not modify. When you select the Record output style, this tool generates a compact public record ClassName(Type field1, Type field2, ...) {} declaration that compiles to a full immutable class.
Note that records cannot have mutable state, so they're not suitable for entities managed by Hibernate or JPA. For database entities, stick with the POJO or Lombok output styles.
One of the most important features of this tool is its type inference engine. Rather than mapping everything to Object or String, it inspects each JSON value and selects the most appropriate Java type:
StringintdoublebooleanObjectList<String>List<Integer>List<NestedClassName>This means the generated code compiles correctly without manual type corrections in the majority of real-world cases.
Real-world JSON from APIs is rarely flat. You might have a user object that contains an address object, which contains a coordinates object. This tool handles that recursively. Each nested object generates its own separate Java class, named based on the key it appears under (converted to PascalCase).
For example, if your JSON has "address": { "city": "Hanoi", "zip": "100000" }, the tool generates a MyModel class with an Address address field, and a separate Address class with String city and String zip fields. Both classes appear in the output tabs, ready to be copied into your project.
Java coding conventions require field names in camelCase: firstName, not first_name or FirstName. JSON from APIs often uses snake_case, kebab-case, or other formats. This tool automatically converts JSON keys to camelCase Java field names. For example, user_id becomes userId, created-at becomes createdAt, and first name becomes firstName.
This is especially useful when working with Python-based APIs (which typically use snake_case) or third-party APIs that use hyphenated keys. The result is Java-idiomatic field names that don't require any @JsonProperty annotations in simple cases.
If the original JSON key differs from the generated Java field name (due to the camelCase conversion), and you're using Jackson for deserialization, you may need to add @JsonProperty("original_key") annotations above each field. This tells Jackson to map the original JSON key to the Java field even when names differ. The current version of this tool does not auto-generate these annotations, but it's a quick manual step after generation if you need strict JSON key mapping.
Spring Boot uses Jackson by default for REST API JSON processing. A generated POJO with standard getter/setter naming will work immediately with @RequestBody and @ResponseBody annotations. For Lombok classes, add Lombok to your project dependencies and enable annotation processing in your IDE. For Java Records, ensure your project uses Java 16 or higher.
If you're using Spring Data JPA, the generated POJO structure works as a starting point for your @Entity classes — you'd add the JPA annotations manually after generation, but the field structure and types are already correct.
com.company.model, enter it in the Package field to get a complete, copy-ready class file.