Convert JSON to Java
POJO, Lombok or
Record. Instantly.
Generate Java POJOs, Lombok @Data classes or Java Records from any JSON sample. Nested objects, List<T> arrays, Jackson annotations — all included. Runs entirely in your browser.
Object — refine manually after generating.
Three steps — paste your JSON and drop the class into your project.
Use a real API response where all fields are present with non-null values. The generator infers Java types from values — a null field becomes Object. Nested objects generate separate classes. Arrays become List<T> with the correct element type.
Select Plain POJO for any Java version, Lombok @Data to eliminate boilerplate, or Java Record for immutable data (Java 16+). Add the package name, enable Jackson annotations for snake_case APIs, and toggle Serializable for Hibernate or RMI use.
Click Generate and copy the Java code into your project — or download as a .java file. The class is immediately usable: instantiate with Jackson ObjectMapper, Gson or any Java JSON library and call objectMapper.readValue(json, YourClass.class).
The three output styles and when to use each.
| Style | Requirements | Best for | Boilerplate |
|---|---|---|---|
| Plain POJO | Any Java version, no dependencies | Maximum compatibility — works with Spring, Jackson, Gson, Hibernate, any framework | High — getters, setters, constructor generated |
| Lombok @Data | Java 8+ · Lombok dependency | Spring Boot projects where Lombok is already a dependency — eliminates all boilerplate | None — @Data generates everything at compile time |
| Java Record | Java 16+ (stable) | Immutable data transfer objects — API responses you only read, never modify | None — records are inherently concise and immutable |
The type inference rules applied to each JSON value.
| JSON value | Java type | Notes |
|---|---|---|
"Alice" |
String |
All JSON strings become String. |
42 |
Integer / Long |
Values ≤ Integer.MAX_VALUE become Integer, larger values become Long. |
98.5 |
Double |
All floating-point numbers become Double. |
true |
Boolean |
Direct mapping to boxed Boolean. |
null |
Object |
Null in the sample means the type is unknown — refine manually after generating. |
["a","b"] |
List<String> |
Item type inferred from first element. Empty array → List<Object>. |
[{…},{…}] |
List<ChildClass> |
Array of objects → separate class + typed List. |
{…} |
ChildClass |
Nested object → separate named class in PascalCase from the key. |
The most common workflows where Java model classes are needed.
When consuming a third-party REST API in a Spring Boot application, you need a Java class for Jackson to deserialise the response. Generating from the actual API response JSON ensures every field is correctly typed — no more manual class writing or mismatched field names.
Jackson's objectMapper.readValue(json, MyClass.class) requires a matching POJO. Generate the class from the JSON response, paste it into your project, and call readValue immediately — no configuration needed for standard field names.
Android apps that consume REST APIs with Retrofit and Gson or Moshi need model classes. Generate from the API response JSON, use Lombok or plain POJO depending on your build setup, and annotate with @SerializedName if field names differ from your Java conventions.
Integrating a modern JSON API with a legacy Java system often requires creating model classes quickly. Generate a complete POJO with getters and setters, add the Serializable interface for JMS or RMI compatibility, and use it directly without any annotation processor dependency.
Java classes generated
in your browser. No upload.
The entire class generation runs in JavaScript locally. Your JSON API response is parsed and traversed entirely in your browser — it is never transmitted to any server. The generated code follows Java conventions: PascalCase class names, camelCase field names, boxed types for nullable fields.
The output is immediately usable with Jackson ObjectMapper, Gson, Moshi or any Java JSON library. For Spring Boot: add the class to your model package and call objectMapper.readValue(response, YourClass.class). No additional configuration needed.
