Free JSON to Java POJO — Lombok · Record · Jackson

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.

Your data never leaves your browser
Plain POJO · Lombok · Record
Nested objects → separate classes
Jackson annotations optional
Always free
JSON to Java POJO Generator   100% client-side
Use a representative JSON sample with non-null values for accurate type inference. Null fields become Object — refine manually after generating.
JSON input
  Java class ready

      

How to convert JSON to a Java POJO

Three steps — paste your JSON and drop the class into your project.

1

Paste your JSON sample

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.

2

Choose style and options

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.

3

Copy and use in your project

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).

Plain POJO vs Lombok vs Record — which to choose

The three output styles and when to use each.

StyleRequirementsBest forBoilerplate
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

How JSON types map to Java types

The type inference rules applied to each JSON value.

JSON valueJava typeNotes
"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.

When do you need JSON to Java POJOs?

The most common workflows where Java model classes are needed.

Spring Boot REST API responses

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 ObjectMapper binding

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 development

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.

Legacy system integration

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.

JSON to POJO converter for Spring Boot, Jackson and Gson

The generated POJO works as-is with the JSON libraries Java projects use: Jackson (Spring Boot's default) maps it with objectMapper.readValue(json, Root.class) or directly as a @RequestBody, and Gson with new Gson().fromJson(json, Root.class). Numbers larger than 2,147,483,647 are typed as Long so 64-bit IDs do not overflow.

To produce sample JSON from an existing class, use Java to JSON. On Android with Kotlin, see JSON to Kotlin.

Related JSON tools

All json to code tools

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.

3 output styles

Plain POJO, Lombok @Data and Java Record — covering every Java version and project setup from Java 8 to the latest LTS.

Nested classes

Each nested JSON object generates a separate named class — no Map<String,Object> shortcuts. Fully typed from top to bottom.

Jackson-ready

Optional @JsonProperty and @JsonIgnoreProperties annotations — handles snake_case APIs and protects against unknown fields in future API versions.

52 tools, always free

No watermarks, no account. Funded by non-intrusive display advertising only.

Frequently asked questions

Common questions about generating Java POJOs from JSON.

How do I convert JSON to a Java POJO?

Paste your JSON sample, set the root class name, choose your output style (POJO, Lombok or Record), and click Generate. The tool infers Java types from your JSON values and outputs complete class definitions. Copy the code directly into your Java project.

What is the difference between POJO, Lombok and Record?

Plain POJO generates a standard Java class with getters, setters and constructors — works with any Java version and library. Lombok @Data uses the @Data annotation to generate all boilerplate at compile time — requires Lombok in your pom.xml or build.gradle. Java Record generates an immutable record available since Java 16 — the most concise option for read-only data transfer objects.

How do I use the generated class with Jackson?

Add the generated class to your project and call: MyClass obj = new ObjectMapper().readValue(jsonString, MyClass.class). For a List: List<MyClass> list = mapper.readValue(jsonArray, new TypeReference<List<MyClass>>(){}). Enable Jackson annotations to handle snake_case field names automatically.

How are nested JSON objects handled?

Each nested JSON object generates a separate named Java class. A user object with a nested address generates a User class and an Address class. All classes are output together — copy them into the same .java file as static inner classes, or into separate files in the same package.

Is the JSON to Java converter free?

Yes, completely free. No account required. JSONSwitcher is funded by non-intrusive display advertising.

Can I use the generated POJO with Gson?

Yes. Plain POJOs, Lombok classes and records work with Gson as well as Jackson; only the annotation style differs.

How are very large numbers typed?

Integers above 2,147,483,647 become Long instead of Integer, so IDs and timestamps in milliseconds do not overflow.
Go up