Code Generators · Runs in your browser

JSON to Java Class (POJO) Generator

Paste a JSON sample and get ready-to-use Java classes, with nested types, arrays and optional fields worked out for you. Ideal for Spring Boot, Retrofit or any Jackson-based project.

JSON
Drop a file to load it
Java
Waiting for input

How to use it

  1. Paste a representative JSON sample, such as an API response.
  2. Set the root type name and pick a style: Jackson classes, records or Lombok @Data.
  3. Copy the Java code or download it as a file.

Jackson annotations

Fields whose JSON name isn’t a valid Java name get @JsonProperty, so mapping works both ways.

One file

Nested types are static classes (or records) inside the root type, so the output compiles as a single file.

Integers vs. decimals

Number types come from how the number is written in your sample: 3 is an integer, 3.0 and 3.5 are decimals, and long IDs use a 64-bit type.