JSON to Java Class

Paste JSON and get Java classes: plain POJOs with getters and setters, Lombok classes or records.

FreeNo sign-upPrivate — runs in your browser
0Classes
0Fields
0Lines

How to use the JSON to Java Converter

  1. Paste JSONPaste an API response or any JSON object, or open a .json file.
  2. Pick a stylePlain classes with getters and setters, shorter Lombok classes, or immutable records. Jackson annotations keep keys that are not camelCase.
  3. Copy the classesPut each public class in its own .java file, or make the nested ones static inner classes.

Example

"is_active": true becomes @JsonProperty("is_active") private boolean isActive; with isActive() and setActive().

The sample gives 4 classes. "orders" becomes List<Order> orders, and the nullable coupon stays a String.

Frequently asked questions

Why are some numbers Long instead of long?

Fields that are null or missing in the sample use wrapper types (Long, Double, Boolean) so they can hold null. Fields always present use primitives.

Do I need Jackson?

Only for keys that are not valid camelCase Java names, such as is_active or keys with dashes. Turn the option off if your JSON keys already match.

Which style should I use?

Records are short and immutable but need Java 16+. Lombok needs the Lombok library. Plain POJOs work everywhere, including older Android projects.

Popular posts from this blog

Character Counter

Speech to Text Online

Keyboard Tester