JSON to Java POJO

Generate a Java Plain Old Java Object (POJO) class from any JSON structure.

Ready.

About JSON to Java POJO Generator

A POJO (Plain Old Java Object) is a simple Java class that holds data as private fields with public getter and setter methods. This tool analyses a JSON document and generates the corresponding Java class hierarchy — saving you from manually writing repetitive boilerplate code.

Generated Code Structure

For each JSON object, a Java class is created with: private fields typed as String, Integer, Double, Boolean, or List<> (for arrays); a get method for each field; and a set method for each field. Nested objects generate additional inner classes.

Integration with Jackson

The generated POJO can be used directly with the Jackson library for JSON serialization/deserialization. Add @JsonProperty annotations if your JSON uses snake_case field names but you prefer camelCase in Java. Use ObjectMapper.readValue(jsonString, Root.class) to deserialize.

Integration with Gson

The same POJO also works with Google's Gson library: new Gson().fromJson(jsonString, Root.class). Add @SerializedName("field_name") for custom field name mapping.

Alternatives to POJO

In modern Java (14+), consider using Records instead of traditional POJOs for immutable data. In Kotlin, data classes accomplish the same with one line of code. This generator targets traditional Java POJOs which remain the most widely compatible approach across all Java versions and frameworks.

Lombok Integration

After generating, consider annotating your class with @Data from Project Lombok to automatically generate getters, setters, equals(), hashCode(), and toString() — eliminating the need to keep them manually written.