Turn a JSON sample into Java POJOs, records or Lombok classes annotated for Jackson
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.Paste a JSON sample and get Java classes annotated for Jackson, as POJOs with getters and setters, records or Lombok @Data. Whole numbers become int, long past 2,147,483,647, any decimal makes a field double, and a value that is null or missing uses the boxed type, such as Integer.
Paste a JSON sample, such as an API response, into the left box.
The Java appears as you type: one Root.java with a nested static class per object, camelCase fields and @JsonProperty where a key differs.
Choose POJO with getters and setters, a record (Java 16+), or Lombok @Data, and set the root class name.
Press Copy, or Download to save Root.java, and read the JSON with Jackson's ObjectMapper.
Java reads JSON into classes, usually with Jackson, and every object in the JSON needs a class whose fields have the right types and names. This converter writes those classes from a sample, so a long API response becomes compiling Java in one paste.
How types are chosen.
| JSON value | Java type |
|---|---|
| "text" | String |
| true / false | boolean |
| 42 (whole numbers only) | int, or long beyond 32 bits |
| 4.5 (any decimal seen) | double |
| null, or missing in some items | Integer, Boolean, Double |
| only null, or mixed kinds | Object |
| [ ... ] | List<...> |
| { } empty | Map<String, Object> |
| { ... } | a nested static class |
One file. The output is a single Root.java: the root class holds every other class as a public static nested class, which Jackson can create and which needs no extra files. When the JSON is an array or a single value, a comment names the type to read it as, such as List<Root.RootItem>.
Names and keys. Fields are camelCase, so user_name becomes userName with @JsonProperty("user_name") keeping the key. Java keywords get an underscore, such as class_. A field like xCoord is written xcoord, because Jackson would otherwise pair it with the getter getXCoord under a different name. An empty key is ignored with @JsonIgnoreProperties, since Jackson cannot name it.
Three styles. A POJO has private fields, getters and setters and works everywhere. A record (Java 16+) is short and immutable. Lombok @Data keeps the fields and lets Lombok write the rest.
The POJO output for 9 samples was compiled with javac and read by Jackson 2.17 with unknown keys and nulls in primitives treated as errors. Nothing you paste leaves the browser.
Paste a JSON sample into the converter and the Java appears beside it: one Root.java with a nested static class for each object. Add Jackson to the project and read the JSON with new ObjectMapper().readValue(json, Root.class), which fills every field from its key.
Putting every class inside Root keeps the whole model in one file that compiles as it is. Jackson can only create a nested class when it is static, because an inner class needs an instance of its outer class first, so every nested class is declared public static.
A field uses the boxed type, such as Integer, Long, Double or Boolean, when the sample shows it as null or some objects leave the key out. A primitive int cannot hold null, and a missing key would quietly become 0, so the boxed type keeps a missing value apart from zero.
Records, from Java 16, are the shortest and immutable, and Jackson 2.12 or later reads them directly. A POJO with getters and setters works on any Java version and with every library. Lombok's @Data writes the getters and setters for you at compile time, keeping the source short.
Jackson finds properties through getters, and it names getXCoord as xcoord by lowering the leading capitals. A field called xCoord would then not meet its own getter, and the property would split in two. The field is named xcoord, with @JsonProperty("xCoord") keeping the original key.
No. The conversion runs in your browser with no request to any server, and the JSON is not stored, so API responses holding tokens or personal data stay on your device. Close the tab and nothing remains.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about JSON to Java Class Converter and anybody who knows can answer. No account needed.
Same job, other tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs · Query String Parser – Split a URL query string into a table of decoded parameters.