Docelora
ToolsAboutContact
Developer tools

JSON to Java

Generate Java model classes for Spring Boot, Android or any Jackson-based project from a JSON sample.

Quick answer: paste a JSON sample – an API response works well – and the Java types appear instantly. Name the root type, adjust the options, then copy or download the code.

JSON to Java

Java types · nested objects · optional fields

Private: your code is processed in this browser tab and never uploaded.

How JSON types map to Java

JSONJava
stringString
whole numberlong (Long if nullable)
decimaldouble (Double if nullable)
true/falseboolean (Boolean if nullable)
objectclass or record
arrayList<T>
null / mixedObject

Good to know

Related tools

Frequently asked questions

How do I convert JSON to a Java object?

Generate the classes here, then use Jackson: new ObjectMapper().readValue(json, Root.class).

POJO or record?

Records (Java 16+) are concise and immutable; POJOs with getters and setters work everywhere, including older frameworks.

Why @JsonProperty?

Java fields use camelCase; the annotation keeps the original JSON key such as full_name.

Why boxed types like Long?

Primitive long cannot be null, so nullable or optional fields use Long, Double and Boolean.

Does it work with Gson?

Gson ignores Jackson annotations – replace @JsonProperty with @SerializedName.

Does it work on Android?

Yes – with Jackson or after switching annotations to Gson or Moshi.

Can I use Lombok?

Yes – delete the getters and setters and add @Data or @Getter/@Setter.

Where do the classes go?

Put each public class in its own .java file, or make nested classes static.

Should I use BigDecimal for money?

Yes – change double to BigDecimal for currency.

How are nested objects named?

From their JSON key in PascalCase – the "address" object becomes Address; array items get a singular name, so "orders" becomes Order.

What happens when array items differ?

All items are merged into one type. Keys missing from some items become optional, and an int that is sometimes a decimal becomes a floating-point number.

How is null handled?

A field that is null in your sample becomes nullable; if it is only ever null, its type cannot be known and a generic type is used – replace it with the real type.

Can I upload a .json file?

Yes – use Open file, or paste the text.

Are dates detected?

No. JSON has no date type, so dates stay strings – convert them after decoding if you need date objects.

Is it free?

Yes – no sign-up, no limits and no watermark.

Is my code uploaded?

No. Everything runs in your browser; nothing you paste is sent to Docelora.

Can I use the output in commercial projects?

Yes. The output is yours to use however you like.

Does it work on a phone or tablet?

Yes – the layout adapts to small screens, though long code is easier to read on a larger display.

How do I copy the result?

Use the Copy button under the result, or Download to save it as a file.

Which browsers are supported?

Current versions of Chrome, Edge, Firefox and Safari.

Last reviewed: 16 November 2026.