Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

JSON to Java Class (POJO)

Paste JSON, get Java classes (one file each) that Jackson can read.

Free preview, no sign-upIncluded in your pass Pro tool Pro pass: ₹179 / $5.99 for 30 days On this device; its files download once
+3 +1 more details No uploadWorks offline once opened Developer

Free preview: the first lines of the generated code (up to 20), with the type, file and line counts and every note on your samples. Locked until you unlock it: download and copy.

Pro pass ₹179 for 30 days or ₹79 for 1 week, one‑time. Pro pass $5.99 for 30 days or $2.99 for 1 week, one‑time. How to unlock

Try before you buy.

  • Free preview: the first lines of the generated code (up to 20), with the type, file and line counts and every note on your samples.
  • Locked until you unlock it: download and copy.
  • Unlock: Pro pass, ₹179 for 30 days or ₹79 for 1 week, a one-time payment unless you choose automatic renewal. Unlock: Pro pass, $5.99 for 30 days or $2.99 for 1 week, a one-time payment unless you choose automatic renewal.

Ways to unlock shows how to get the full result.

See passes (opens in a new tab)

Printing this result is locked in the free preview.

One JSON document, or several samples one after another or one per line (JSON Lines). Comments and trailing commas are ignored. Your data stays in this browser.

Type inference

Next steps Done. What next?

Start over

A Pro pass unlocks the full result. See passes

All developer tools

About the JSON to Java Class (POJO)

Paste a JSON response and get Java classes for it — one class per file, in your package. Choose plain POJOs (private fields with getters and setters), or Jackson-annotated classes whose @JsonProperty names keep every JSON key exactly, plus a Converter class with fromJsonString and toJsonString. Nested objects become their own classes, arrays List<T> or T[], integers long, decimals double, dates OffsetDateTime / LocalDate (or java.util.Date), UUIDs UUID; values that can be missing or null use the boxed types (Long, Double, Boolean).

Tick Lombok to get @lombok.Data instead of hand-written accessors, and, with a pass, download every .java file as a ZIP with the package folders already in place. Generation runs in your browser, so nothing you paste is uploaded.

Without a pass you see a free preview: the type, file and line counts and every note on your samples, with the first lines of the first generated classes (each class is a file of its own). A Pro pass unlocks the whole code of every file, with Copy, Download and the ZIP.

How to use it

  1. Paste JSON or open or drop a .json file, or press Load sample. Several samples one after another (or JSON Lines) give more accurate optional fields.
  2. Set the Root class name and the Package.
  3. Choose Jackson annotations (with a Converter class) or Plain POJOs, and optionally Lombok, the date types and List<T> or arrays.
  4. Pick a file in File to see one class, or All files to see them together.
  5. With a pass, or after unlocking this result, copy the code, download the selected .java file, or Download all (.zip) — the ZIP has com/example/model/… folders that match the package.

Examples

Plain POJO
Input
{"id": 1, "employeeId": 7, "fullName": "Lata", "active": true, "score": 2.5}
Result
public class Employee {
    private long id;
    private long employeeId;
    private String fullName;
    private boolean active;
    private double score;

    public long getId() { return id; }
    public void setId(long value) { this.id = value; }
    …
}

Root class name Employee, style Plain POJOs.

Jackson enum that maps each JSON value
Input
[{"role": "admin"}, {"role": "in-progress"}, … 12 users with three roles]
Result
public enum Role {
    ADMIN, IN_PROGRESS, VIEWER;

    @JsonValue
    public String toValue() { … return "in-progress"; … }

    @JsonCreator
    public static Role forValue(String value) throws IOException { … }
}
Lombok
Input
{"id": 1, "name": "x"}
Result
package com.example.model;

@lombok.Data
public class Item {
    private long id;
    private String name;
}

Root class name Item, Plain POJOs with Lombok.

Common uses

  • Creating request and response classes for a Spring Boot, Quarkus or Android REST client.
  • Reading webhook payloads or JSON config files with Jackson.
  • Turning a JSON Schema into model classes, like jsonschema2pojo, without installing anything.
  • Getting a starting point for DTOs with Lombok.

Jackson classes or plain POJOs?

  • Jackson annotations: every getter and setter has @JsonProperty("…"), so JSON names such as user_id or userURL map to Java names (getUserId(), getUserUrl()). Enums get @JsonValue / @JsonCreator, so a value like "in-progress" maps to IN_PROGRESS. Converter.fromJsonString(json) sets up an ObjectMapper that ignores unknown properties, registers the modules on the classpath (findAndRegisterModules()) and parses ISO date-times. Add jackson-databind (and jackson-datatype-jsr310 for java.time) to your build.
  • Plain POJOs: no annotations and no dependencies. Jackson and Gson then match JSON names to bean or field names, which works for camelCase keys such as employeeId — the notes list any keys that cannot match (snake_case, dashes, runs of capitals, keywords).

The output for the sample data was compiled with javac 21 in both styles, and the Jackson version was run against Jackson 2.16 to read and write the sample JSON.

Dates, numbers and missing values

  • ISO 8601 date-times become OffsetDateTime, dates LocalDate and times OffsetTime (java.time); choose java.util.Date for older code. Untick Detect dates to keep them as String.
  • The generated Converter parses date-times into UTC: "2026-08-02T18:02:11+05:30" comes back as 2026-08-02T12:32:11Z — the same instant, written in UTC.
  • Whole numbers are long, numbers with decimals double; a value that can be missing or null uses Long, Double or Boolean, so "not sent" is null rather than 0 or false.
  • Java has no unsigned or 128-bit integers; the notes warn about integers that do not fit in 64 bits.

Limitations

  • Types are inferred from your samples only — paste several real responses for accurate optional fields.
  • The output is classic classes with getters and setters (or Lombok); Java records and builders are not generated.
  • Lombok needs the Lombok dependency and annotation processing in your build; with Lombok on, the class has fields only.
  • JSON Schema references must point inside the schema (#/$defs/…), and validation keywords such as pattern are not turned into Bean Validation annotations.

Privacy

On this device; its files download once

Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot. The code generator (about 330 KB compressed) is downloaded from this site once, like the rest of the page; your JSON is never uploaded.

How to check that nothing is uploaded

Frequently asked questions

What do I get without a pass?

Without a pass, JSON to Java Class (POJO) shows the first lines of the generated code (up to 20), with the type, file and line counts and every note on your samples. Until you unlock it, the result can’t be downloaded or copied. A Pro, Premium or Ultimate pass, a one-time payment unless you choose automatic renewal, unlocks the full result. The pricing page lists the passes and their prices.

Is my JSON uploaded?

No. The classes are generated in your browser, in a background worker, and the page works offline once it has loaded.

Why is a getter called getUserUrl() when my JSON key is userURL?

Java names use camel case for acronyms (userUrl, getId), as in most style guides. With Jackson annotations the @JsonProperty("userURL") keeps the JSON name exact; with Plain POJOs such keys are listed in the notes because a library would look for userUrl instead.

Which Jackson version is needed?

The generated code uses long-standing Jackson 2 APIs (ObjectMapper, @JsonProperty, @JsonCreator, @JsonValue); the comment in Converter.java names 2.9.0 as a minimum. It was tested with Jackson 2.16.

How do I read a top-level JSON array?

Name the root after one item (for example User) and keep the array as the input: Converter.fromJsonString(json) then returns List<User> (or User[] with arrays).

Do I need a pass?

To copy or download the whole generated code, yes: a Pro pass unlocks every Pro tool. Without a pass you see a free preview of your own result: the first lines of the generated code (up to 20), with the type, file and line counts and every note on your samples. Your JSON is never locked and never uploaded.

Learn more

Lessons on MySmartCoPilot Learn that use this tool:

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.