JSON to POJO

Convert JSON to Java classes — Lombok or Records

Paste JSON and get Java model classes back instantly. Choose Lombok-annotated POJOs for mutable beans with generated getters, setters, equals, and hashCode, or Java Records for immutable value types. Field types are inferred from the data, nested objects become their own classes, and Jackson @JsonProperty annotations preserve the original JSON key names.

Options on this page

Output formats: Lombok (@Data class — getters, setters, equals, hashCode, toString), Record (Immutable Java 16+ record with compact components).

OptionWhat it does
Root Class NameNames the top-level POJO.
Package Name (optional)Emitted as a package declaration at the top of each file.
Field Naming ConventionOne of camelCase, PascalCase, Preserve Original. Defaults to camelCase.
Type for null valuesEither Object or String, used when a key is null in every sample.
Use PrimitivesEmit int / long / double / boolean instead of their wrapper classes.
Separate ClassesWrite each nested object to its own file instead of nesting it as a static inner class.
Add @JsonPropertyAnnotate fields with the original JSON key so Jackson maps them correctly.
Add @BuilderAdd Lombok's @Builder for fluent construction.

How JSON values map to Java types

JSON valueJava type
stringString
integerInteger (int)
integer beyond 32 bitsLong (long)
decimalDouble (double)
true / falseBoolean (boolean)
ISO-8601 timestampLocalDateTime
arrayList<T>
objectnested class
nullObject (configurable)

Example

Input JSON

{
  "id": 12345,
  "product_name": "Wireless Mouse",
  "price": 24.99,
  "in_stock": true,
  "tags": ["electronics", "accessories"],
  "manufacturer": {
    "name": "Acme Corp",
    "country": "US"
  }
}

Generated Java

@Data
public class Product {
    @JsonProperty("id")
    private Integer id;
    @JsonProperty("product_name")
    private String productName;
    @JsonProperty("price")
    private Double price;
    @JsonProperty("in_stock")
    private Boolean inStock;
    @JsonProperty("tags")
    private List<String> tags;
    @JsonProperty("manufacturer")
    private Manufacturer manufacturer;
}

Frequently asked questions

What is the difference between the Lombok and Record output?

Lombok output is a mutable class annotated with @Data, which generates getters, setters, equals, hashCode, and toString at compile time — use it when a framework needs a no-arg constructor and setters. Record output is an immutable Java 16+ record whose components are final and whose accessors are named after the field. Records are shorter but cannot be mutated after construction.

Do I need Jackson to use the generated Java classes?

Only if you leave @JsonProperty enabled. Those annotations come from Jackson (com.fasterxml.jackson.annotation) and map a JSON key like product_name onto a Java field named productName. Turn the option off if you deserialize with something else or your keys already match your field names.

Is my JSON uploaded anywhere?

No. Parsing, type inference, and code generation all run in your browser using JavaScript. Your JSON is never sent to a server, and there is no account, tracking, or storage beyond your own browser.

Does it cost anything?

No. The generator is free to use with no sign-up and no usage limits.

How are nested objects handled?

Each nested JSON object becomes its own named type, derived from the key it appeared under. Arrays of objects are widened across every element, so a field that is a whole number in one element and a fraction in another gets a type that holds both.

Other languages