JSON to Java POJO

Generate Java POJO classes with Jackson getters/setters or Lombok @Data from any JSON object.

What is a Java POJO?

A POJO (Plain Old Java Object) is a simple Java class that represents data — typically a JSON object or API response body. It has private fields, public getters and setters, and no business logic. POJOs are used by serialization libraries like Jackson to convert between JSON strings and Java objects (deserialization and serialization).

Writing POJOs by hand for complex JSON responses is tedious and error-prone. This tool reads any JSON object and generates the complete Java class hierarchy in seconds. Choose Jackson mode (explicit getters/setters with @JsonProperty) for maximum compatibility, or Lombok mode (@Data) to eliminate boilerplate in modern Spring Boot applications.

Jackson vs Lombok

FeatureJackson ModeLombok Mode
Class annotation@JsonIgnoreProperties@Data + @JsonIgnoreProperties
BoilerplateGenerates getters/settersLombok generates at compile time
Dependencyjackson-databindjackson-databind + lombok
MutabilityMutable (setters)Mutable (setters via @Data)
Best forStandard Java projectsModern Spring Boot apps

Lombok Maven Dependency

xml
<dependency>
  <groupId>org.projectlombok</groupId>
  <artifactId>lombok</artifactId>
  <optional>true</optional>
</dependency>

Example: Jackson Mode Output

java
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Root {
    private Long id;
    @JsonProperty("first_name")
    private String firstName;
    private Boolean active;

    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }
    public String getFirstName() { return firstName; }
    public void setFirstName(String firstName) { this.firstName = firstName; }
    public Boolean getActive() { return active; }
    public void setActive(Boolean active) { this.active = active; }
}

Type Mapping

JSON TypeJava TypeNotes
stringStringStandard java.lang.String
integerLongAvoids int overflow for large IDs
floatDoubleDouble precision
booleanBooleanBoxed for null safety
nullObjectMost permissive nullable type
arrayList<T>java.util.List
objectClassNew named POJO class

Frequently Asked Questions

Lombok @Data is recommended for Spring Boot — it eliminates boilerplate and integrates perfectly with Spring's dependency injection and Jackson auto-config.

Yes. The generated classes use standard Jackson annotations which are compatible with Quarkus, Micronaut, and Jakarta EE.

Keys are converted to camelCase and a @JsonProperty annotation is added with the original key name.

It makes the class tolerant of new or unexpected fields in the JSON response, preventing deserialization errors when the API evolves.

Yes — the generated getters/setters are standard JavaBeans convention, fully compatible with MapStruct, ModelMapper, and Dozer.

Related Tools