← All Tools
JSON To Java Class Converter🔒 100% local
Convert JSON to Java POJO. Privacy-first, no server uploads, no tracking.
Produces Java POJO source from a JSON object: a public class Root with private fields, camelCase names, and a getter and setter for each key, under an import java.util.List; line. Nested objects and arrays of objects generate extra classes named after the key, and the output closes with a Jackson snippet. The conversion runs entirely in the page.
How to use it
- Paste a single JSON object.
- Run the conversion to get the class file.
- Copy the class file, rename Root to whatever your model is called, and add packages and annotations as your project needs.
Worked example
{"name":"Ada","age":36}becomes// Java POJOs generated from JSON
import java.util.List;
public class Root {
private String name;
private long age;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public long getAge() { return age; }
public void setAge(long age) { this.age = age; }
}
// Jackson: ObjectMapper.readValue(json, Root.class)Whole numbers map to the primitive long, so a field that can be absent or null needs a manual change to Long.
When to use it
- Writing the request and response classes for a REST client by hand and you already have a sample payload.
- Generating the POJOs to paste under a Jackson or Gson mapping.
- Turning a recorded API fixture into Java types for a test.
What it does not do
- The root must be a JSON object; an array throws 'Provide a JSON object.'
- Nothing is annotated, so the original key is lost when it is not camelCase-compatible: user-id becomes the field userId with no @JsonProperty, and Jackson will not match it.
- No equals, hashCode or toString, no Lombok or record form, and null or mixed-type fields degrade to Object; array element types come from the first element only.