JSON to Java Class (POJO) Generator

Generate Java POJO classes from JSON with getters, setters and optional Jackson @JsonProperty annotations.

Runs in your browser Free
Processed locally in your browser.

Types are inferred from the sample. Fields missing in some array items become optional; null values become nullable.

Model classes for Java projects

Writing POJOs for API responses in Spring Boot apps, Android projects or microservices is repetitive. The JSON to Java generator creates these classes automatically.

The right types

  • Primitive types such as int, double and boolean for fields that always have a value
  • Boxed types such as Integer, Double and Boolean for fields that can be missing or null
  • List<T> for arrays
  • Separate classes for nested objects

Jackson support

Optionally add @JsonProperty annotations to keep the mapping between Java-style field names and JSON keys. Code is generated in your browser.

How to use JSON to Java Class (POJO) Generator

  1. Paste sample JSON data.
  2. Set the class name and Jackson preference.
  3. Review the generated Java code.
  4. Copy the classes into your project.

Why use this tool?

Cuts boilerplate writing time and reduces null-related bugs through the right type choices.

FAQ

Why is a field Integer instead of int?

Because it's null or missing in some samples; int can't hold null.

Can I use Lombok?

Delete the generated getters and setters and add @Data to the class to use Lombok.

Can it generate Java records?

The tool generates classic POJO classes.

Related tools