JSON to POJO

Generate complete Java POJO classes directly from a JSON object, including typed private fields, no-args constructors, and individual getters and setters for every property. Nested objects are promoted to their own classes automatically, and you can opt in to Lombok @Data, Jackson @JsonProperty, and a hand-written toString() override with a single checkbox. The generator runs entirely in your browser — paste JSON and copy production-ready Java in seconds.

Input

JSON

Class Name

Code Style

Output

Java POJO

What is JSON to POJO Converter?

Generate plain Java POJO classes with full getters, setters, toString, equals, and hashCode methods from JSON in your browser — no upload, no account required. This browser-based tool goes beyond basic model generation by producing complete, IDE-ready Java classes that follow JavaBeans conventions. It is designed for Java EE, Spring, and legacy enterprise developers who need fully fleshed-out model classes without Lombok dependencies. Options include builder pattern generation, serialization interfaces, and both Newtonsoft and Jackson annotation styles. All generation is client-side — your proprietary schemas never leave your device.

How to Use

  1. 1

    Paste Your JSON

    Paste a JSON object or array into the editor. The generator analyses value types and produces a POJO with the appropriate Java field types for each key.

  2. 2

    Configure POJO Style

    Set the class name, choose Jackson or Gson annotation style, enable Lombok @Data to skip getter/setter generation, and select whether to include a toString() and equals()/hashCode() implementation.

  3. 3

    Generate the POJO Classes

    Click "Generate POJO". Each nested object becomes its own class, JSON types map to Java types (String, Integer, Double, Boolean, List<T>), and @JsonProperty annotations are added for non-matching key names.

  4. 4

    Use in Your Java Project

    Copy the classes into your project. With Jackson, use new ObjectMapper().readValue(json, Root.class). With Gson, use new Gson().fromJson(json, Root.class). Add the relevant dependency to your pom.xml or build.gradle.

Common Use Cases

Jackson & Gson Deserialisation

Generate Java POJOs with getters, setters, and no-arg constructors from JSON API responses for use with Jackson ObjectMapper or Gson for automatic deserialisation in Spring Boot and Java EE applications.

Lombok-Annotated Model Classes

Scaffold Java POJO base classes from JSON structures, then add Lombok @Data, @Builder, or @Value annotations to eliminate boilerplate getter/setter code in modern Java projects.

Android Retrofit Models

Generate POJO response models from REST API JSON samples for Android apps using Retrofit with GsonConverterFactory, enabling type-safe API call responses without manual model writing.

Java EE Data Transfer Objects

Create Java DTO classes from JSON payload samples for JAX-RS or Spring MVC endpoints, providing clean separation between the API layer JSON contract and internal domain model classes.

Conversion Examples

JSON Object → Java POJO

A JSON object generates a Java class with private fields, getters, setters, and a no-arg constructor.

Input JSON

{
  "id": 1,
  "firstName": "Alice",
  "lastName": "Smith",
  "email": "alice@example.com"
}

Output CSV

public class Root {
    private int id;
    private String firstName;
    private String lastName;
    private String email;

    public Root() {}

    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    public String getFirstName() { return firstName; }
    public void setFirstName(String firstName) { this.firstName = firstName; }
    // ... additional getters/setters
}

Nested JSON → Nested POJOs

Nested objects generate separate POJO classes with typed field references.

Input JSON

{
  "order": {
    "id": 101,
    "customer": {"id": 1, "name": "Alice"},
    "total": 149.99
  }
}

Output CSV

public class Customer {
    private int id;
    private String name;
    // getters/setters...
}

public class Order {
    private int id;
    private Customer customer;
    private double total;
    // getters/setters...
}

public class Root {
    private Order order;
    // getters/setters...
}

Frequently Asked Questions