Paste a JSON sample and get clean Java classes ready for Jackson — nested objects become their own classes, arrays become List types, and every field carries a @JsonProperty tag. Fast, secure, and entirely in your browser.
No installation, no signup. Results in milliseconds.
A JSON to Java converter reads a sample of JSON and writes the Java classes, POJOs, that describe its shape, ready to deserialize with Jackson's ObjectMapper. Instead of hand-writing a class for every API response, you paste the response and get typed classes you can drop into your package.
Java needs a concrete type to bind JSON to, and writing those classes by hand for a large payload is slow and error-prone, especially the annotations that map camelCase fields to the API's actual keys. Generating them from a real sample means the fields, types, and tags match the data exactly.
List<String>, List<Item>).Long, Double, Boolean) so any field can be null.@JsonProperty tag per field, and the imports you need.These are the inference rules the converter applies so the output is predictable.
| JSON | Becomes in Java |
|---|---|
Object { } | A class with one field per key. |
| Nested object | Its own named class, referenced from the parent field. |
Array [ ] | A List<T> such as List<String> or List<Item>. |
| Whole number | Long. |
| Decimal number | Double. |
| string / boolean | String / Boolean. |
| null only / mixed types | Object (or List<Object> for a mixed array). |
Every field gets a @JsonProperty("key") annotation carrying the original JSON key, so a camelCase Java field maps to a snake_case or otherwise-named key without a custom naming strategy. Boxed wrapper types (Long, Double, Boolean) are used throughout, because a primitive like long cannot be null and so cannot represent a missing or null JSON value. Validate the JSON first with the JSON parser if it will not convert, or tidy it in the JSON formatter.
ObjectA field that is only ever null, an empty array, or holds more than one unrelated type has no single concrete Java type, so it falls back to Object. Paste a representative sample with those fields populated to get precise types, and give an array of several records so every key is seen. For a deeply nested payload, expanding it in the JSON viewer first helps you confirm the shape.
See how a nested object with an array of items becomes clean, annotated Java classes.
Notice three things: items became its own Item class and a List, total is a Double because the sample has a decimal, and every field carries its @JsonProperty tag. For the step-by-step reasoning, see our guide on converting JSON to Java classes.
Typed POJOs from real data, in seconds.
Everything developers ask about generating Java classes from JSON.
@JsonProperty("key") annotation using the original JSON key, so a camelCase Java field still maps to a snake_case or otherwise-named key. You can turn the annotations off if you prefer plain fields.Long and numbers with a decimal point become Double. Boxed types are used throughout so any field can be null, which is safer than primitives for JSON that may omit values.long cannot be null, so it cannot represent a missing or null JSON value. Boxed types (Long, Double, Boolean) can be null, which matches how JSON actually behaves and avoids surprises on deserialization.List<String> or List<Item>, with the element type inferred from the items.Object (or List<Object> for a mixed array).mapper.readValue(json, Root.class). Add getters or Lombok if your style needs them.Hands-on articles from our blog.
All free, all browser-based, no signup required.