JSON to Java

Generates Java records from a JSON sample. Keys become camelCase components, nested objects become their own records, and any field that can be absent or null uses a boxed type such as Long or Boolean so it can hold null. Output targets Java 16 or newer. Runs entirely in your browser — nothing is sent to a server.

Ad placeholder: Resp_Horizantal_1 (horizontal)
Ad placeholder: Resp_Square_1 (square)

Generates Java records from a JSON sample. Keys become camelCase components, nested objects become their own records, and any field that can be absent or null uses a boxed type such as Long or Boolean so it can hold null. Output targets Java 16 or newer. Runs entirely in your browser — nothing is sent to a server.

Use cases

  • Turning an API response into records for a Java client
  • Replacing hand-written POJOs with generated records

Examples

Nested object

{"id":1,"name":"Ada","tags":["math"],"address":{"city":"London"}}
import java.util.List;

public record Root(long id, String name, List<String> tags, Address address) {}

public record Address(String city) {}

FAQ

Is my data sent to a server?

No — this tool runs entirely in your browser.

Why are some types boxed?

Java primitives cannot be null. A field that is missing from some records, or that is sometimes null, is emitted as Long, Double, or Boolean so the absent value can be represented.

Can all the records go in one file?

No. Java requires each public type in its own file, so save each record as its own .java file, or nest them inside a container class.