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
- 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.
- The Java code appears instantly in the Output panel and updates as you type.
- Rename the top-level type under Settings → Root type name, and use Sort keys to order fields alphabetically.
- Copy the code or Download it as
Root.java.
What the Java generator produces
- Java 16+
recordtypes: immutable, with constructors, accessors,equalsandhashCodebuilt in. @JsonProperty("key")on every component so names can follow Java conventions.long,doubleandboolean, switching toLong,DoubleandBooleanwhen 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.