JSON to Java Converter
Paste a JSON object and get ready-to-use Java POJO classes — with field types, nested classes, and optional Lombok or getters/setters.
Last updated: May 27, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is JSON to Java Converter?
When integrating with a JSON-returning API in Java, you typically map the JSON onto a set of POJO classes that a library like Jackson or Gson can deserialize into. Writing the classes by hand is tedious — each field needs a type, a private declaration, and (without Lombok) a getter and a setter.
This tool reads a JSON example and emits the matching class hierarchy. Integer fields use `Integer`, big integers use `Long`, decimals use `Double`, strings use `String`, booleans use `Boolean`, and nested objects produce nested classes. Arrays become `List<T>` where `T` is the inferred element type. Java reserved words and characters that are invalid in identifiers are handled automatically.
How to Use JSON to Java Converter
Paste a JSON object (root must be an object, not an array or primitive).
Set the root class name and an optional package.
Pick a style: Lombok @Data, full getters/setters, or fields-only.
Copy the generated classes into your project.
Common Use Cases
- Bootstrapping Java DTOs from a sample API response.
- Generating model classes for Jackson, Gson, or Moshi deserialization.
- Producing a starting point for a backend Java service consuming JSON.
- Translating an OpenAPI example into POJO classes.
Example Input and Output
A flat JSON object generates a Java POJO with Integer, String, Boolean, and Double fields.
{
"userId": 42,
"name": "Alice",
"active": true,
"score": 87.5
}public class Root {
private Integer userId;
private String name;
private Boolean active;
private Double score;
// getters and setters omitted
}Privacy
All conversion happens in your browser. No JSON is sent to a server.
Reserved keywords
If a JSON key matches a Java keyword (class, public, etc.), the field is renamed with a Field suffix to avoid a compile error. Adjust the renaming manually if you need a different convention.
Jackson annotations
For exact field-name mapping to JSON keys, add @JsonProperty annotations after generation — this tool focuses on the structural class hierarchy.
Frequently Asked Questions
How are integer types decided?
Integers within int32 range (±2,147,483,647) use Integer. Larger integers use Long. Any number with a decimal uses Double.
Why use Integer/Long/Double instead of int/long/double?
JSON values can be null, so fields must use the boxed types. If you want primitives, switch them manually after generation — the JSON has to guarantee non-null for that to be safe.
What does Lombok mode produce?
It annotates each class with @Data and @NoArgsConstructor, removing the need for explicit getters, setters, equals, hashCode, and toString.
Does this support nested arrays of objects?
Yes. An array of objects becomes List<NestedClass>, where NestedClass is generated from the first element of the array.
Does this send my JSON anywhere?
No. All generation happens locally in your browser.
Related Tools
JSON to Proto Converter
Generate a Protocol Buffers (proto3) schema from an example JSON object. Infers field types, creates nested messages, and handles arrays as repeated fields.
JSON to TypeScript Interface
Convert any JSON object into TypeScript interfaces instantly — handles nested objects, arrays, union types, optional fields, and generics.
JSON to XML Converter
Convert JSON to XML online. Nested objects and arrays are mapped to XML elements with configurable root element name and optional XML declaration.
JSON to CSV Converter
Convert a JSON array of objects to CSV. Flattens nested objects with dot-notation columns and handles arrays within values.
JSON Formatter
Format, validate, and beautify JSON instantly — with clear error messages, Tree View, Diff mode, and Schema validation.
JSON Validator
Validate JSON syntax online. Shows valid/invalid status, error location (line and column), and structure stats including type, key count, and depth.

