Java classes from a JSON sample
Paste a JSON document and get one public class per object shape with private fields, Jackson-annotated accessors, and a converter that parses and writes the top-level type. Nested objects become their own classes; arrays become List<T>.
Example
package io.quicktype;
import com.fasterxml.jackson.annotation.*;
import java.util.List;
public class Customer {
private long id;
private String name;
private List<Order> orders;
@JsonProperty("id")
public long getId() { return id; }
@JsonProperty("id")
public void setId(long value) { this.id = value; }
@JsonProperty("orders")
public List<Order> getOrders() { return orders; }
@JsonProperty("orders")
public void setOrders(List<Order> value) { this.orders = value; }
}
The Order class follows the same shape. A key present in only some orders, such as gift, becomes a boxed Boolean so a missing value is null rather than a failed decode.
Lombok
Check Lombok annotations to drop the hand-written accessors and emit @Data and @NoArgsConstructor on each class instead. The @JsonProperty annotations move onto the fields, and Copy accessor annotations controls whether Lombok is told to copy them onto the generated getters.
Dates and collections
Dates defaults to java.time, producing OffsetDateTime fields and a converter that registers the JavaTimeModule. Legacy produces java.util.Date. Arrays chooses List<T> or T[].
Limits
Java has no union type, so a field that mixes types in the sample becomes a small holder class with one nullable member per type and a custom deserializer. Repeated string values become an enum with a forValue factory when enum inference is on.