JSON to Java Class Generator

Create Java POJOs or records with Jackson annotations from example JSON.

100% Client-Side Processing — your data never leaves this browser. Works offline. How it works

0 lines • 0 bytes Ready
Tip: drop a file anywhere on the editor
Input
Paste, type or drop a file
1
Result
Updates as you type
// Output will appear here…
About this tool

How the JSON to Java Class works

Generate Java POJOs with getters and setters, or Java records, from JSON. Jackson @JsonProperty for renamed keys and nested static classes.

How to use the JSON to Java Class

  1. Paste JSON.
  2. Choose class or record and set the root name.
  3. Copy the code into a .java file named after the root class.

JSON to Java Class example

Input
{"id":7,"userName":"aarav","tags":["a"]}
Result
import java.util.List;

public record User(
        Integer id,
        String userName,
        List<String> tags
) {}

When to use it

  • Mapping REST API responses in Spring Boot.
  • Creating DTOs for request bodies.
  • Typing JSON configuration in Java apps.

Tip: Records are immutable and need no getters, which makes them a good fit for DTOs on Java 16 and later.

Class or record

Classic POJOs with private fields, getters and setters, or compact Java 16+ records.

Jackson-ready

Keys that are renamed for Java (user_name → userName) get @JsonProperty with the original key.

Nested types

Nested objects become public static nested classes or records in the same file.

Boxed types

Integer, Long, Double, Boolean and List<T> so missing values can be null.

FAQ

Common questions

Why boxed types instead of int?

JSON fields can be missing or null; Integer and Double can hold null where int cannot.

Which JSON library does it target?

Jackson, through @JsonProperty. Gson users can replace it with @SerializedName.

Are dates typed?

ISO date-times become OffsetDateTime and dates LocalDate; register Jackson's JavaTimeModule to deserialize them.

Is my JSON uploaded?

No, generation happens in your browser.