JSON to Java Class Generator

Paste JSON, get Java code instantly. Private, in your browser.

Input

Output

Ready
Ln 1, Col 1

Convert JSON to Java in one step

Paste JSON and get Java records annotated for Jackson. Each JSON object becomes a record, with camelCase component names mapped to the original keys through @JsonProperty.

How to use it

  1. Paste a JSON sample into the Input panel, open a file, or drop it onto the page. A sample is already loaded so you can see the result.
  2. The Java code appears instantly in the Output panel and updates as you type.
  3. Rename the top-level type under Settings → Root type name, and use Sort keys to order fields alphabetically.
  4. Copy the code or Download it as Root.java.

What the Java generator produces

  • Java 16+ record types: immutable, with constructors, accessors, equals and hashCode built in.
  • @JsonProperty("key") on every component so names can follow Java conventions.
  • long, double and boolean, switching to Long, Double and Boolean when a value can be null.
  • Arrays become List<T>; nested objects become their own records.

Using the generated Java code

Deserialize with Jackson (Spring Boot already includes it):

ObjectMapper mapper = new ObjectMapper();
Root data = mapper.readValue(json, Root.class);
System.out.println(data.users().get(0).name());

More JSON tools

All tools are free and run privately in your browser.

JSON to Java FAQ

Can I generate classes instead of records?

Records need Java 16 or newer. For older versions, turn each record into a class with private fields and getters; the @JsonProperty annotations stay the same.

Does it work with Gson?

Yes, with a small change: replace @JsonProperty with Gson's @SerializedName annotation.

Is my data uploaded to a server?

No. The JSON to Java runs entirely in your browser using JavaScript. Your data is never uploaded, logged or stored, and the tool keeps working offline after your first visit.