Data to Class

JSON to Java Class Generator

Turn a JSON sample into ready-to-use Java classes with getters and setters.

Java Output
Output will appear here

Generate Java classes from a JSON sample

Paste a JSON response or sample and get ready-to-use Java POJO (Plain Old Java Object) classes — private fields with proper types, plus getters and setters for each one, following standard Java naming conventions. Nested objects become their own classes automatically.

What the generator produces

  • Private fields with inferred types (int, double, String, boolean) and camelCase names, even if your JSON uses snake_case keys.
  • Getters and setters for every field, following Java convention — including isFieldName() instead of getFieldName() for boolean fields, matching idiomatic Java style.
  • Nested classes for nested JSON objects, named after their parent key.
  • List<T> fields for JSON arrays, with the correct import statement added automatically when needed.
  • Deduplicated classes — if two different JSON objects happen to have the exact same field shape, only one Java class is generated and reused.

Typical use cases

  • Consuming a REST API in Java: Quickly scaffold the model classes for a JSON response you're about to deserialize with Jackson or Gson.
  • Prototyping: Get a working starting point instead of hand-typing boilerplate getters and setters.

Frequently Asked Questions

Not currently — the generated classes are plain POJOs. If your JSON keys don't match the generated camelCase field names, most JSON libraries (like Jackson) can still map them with a @JsonProperty("original_key") annotation added by hand, or by configuring a naming strategy globally.
Whole numbers are typed as int; numbers with a decimal point are typed as double. If you need a different numeric type (like long for large IDs), adjust the generated field type manually.
A field that's null in your sample is typed as Object, since there's no type information to infer from a null value alone. Update it manually once you know the field's real type.
Yes — an array of objects generates a List<T> field where T is a properly generated nested class for the object shape inside the array.