WebToolsPlanet
Converter Tools

JSON to Java Converter

Paste a JSON object and get ready-to-use Java POJO classes — with field types, nested classes, and optional Lombok or getters/setters.

Last updated: May 27, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is JSON to Java Converter?

When integrating with a JSON-returning API in Java, you typically map the JSON onto a set of POJO classes that a library like Jackson or Gson can deserialize into. Writing the classes by hand is tedious — each field needs a type, a private declaration, and (without Lombok) a getter and a setter.

This tool reads a JSON example and emits the matching class hierarchy. Integer fields use `Integer`, big integers use `Long`, decimals use `Double`, strings use `String`, booleans use `Boolean`, and nested objects produce nested classes. Arrays become `List<T>` where `T` is the inferred element type. Java reserved words and characters that are invalid in identifiers are handled automatically.

How to Use JSON to Java Converter

1

Paste a JSON object (root must be an object, not an array or primitive).

2

Set the root class name and an optional package.

3

Pick a style: Lombok @Data, full getters/setters, or fields-only.

4

Copy the generated classes into your project.

Common Use Cases

  • Bootstrapping Java DTOs from a sample API response.
  • Generating model classes for Jackson, Gson, or Moshi deserialization.
  • Producing a starting point for a backend Java service consuming JSON.
  • Translating an OpenAPI example into POJO classes.

Example Input and Output

A flat JSON object generates a Java POJO with Integer, String, Boolean, and Double fields.

JSON input
{
  "userId": 42,
  "name": "Alice",
  "active": true,
  "score": 87.5
}
Generated Java class
public class Root {
    private Integer userId;
    private String name;
    private Boolean active;
    private Double score;
    // getters and setters omitted
}

Privacy

All conversion happens in your browser. No JSON is sent to a server.

Reserved keywords

If a JSON key matches a Java keyword (class, public, etc.), the field is renamed with a Field suffix to avoid a compile error. Adjust the renaming manually if you need a different convention.

Jackson annotations

For exact field-name mapping to JSON keys, add @JsonProperty annotations after generation — this tool focuses on the structural class hierarchy.

Frequently Asked Questions

How are integer types decided?
Integers within int32 range (±2,147,483,647) use Integer. Larger integers use Long. Any number with a decimal uses Double.
Why use Integer/Long/Double instead of int/long/double?
JSON values can be null, so fields must use the boxed types. If you want primitives, switch them manually after generation — the JSON has to guarantee non-null for that to be safe.
What does Lombok mode produce?
It annotates each class with @Data and @NoArgsConstructor, removing the need for explicit getters, setters, equals, hashCode, and toString.
Does this support nested arrays of objects?
Yes. An array of objects becomes List<NestedClass>, where NestedClass is generated from the first element of the array.
Does this send my JSON anywhere?
No. All generation happens locally in your browser.