JSON to Java Class

Generate Java class definitions from JSON. Supports nested objects, arrays, Lombok annotations, Jackson @JsonProperty, and auto-generated getters/setters.

Input data is processed in your browser
Data is never sent to a server

Tool

Root class name
Package name
Indent:

or drag & drop a file

What is the JSON to Java Class Converter?

This tool generates Java class definitions from JSON — ideal for quickly creating model classes from API responses, configuration files, or any JSON data structure.

Nested objects are expanded into separate named classes, arrays are typed as List<T>, and all classes are output in dependency order. Lombok and Jackson support makes the generated code ready to drop into Spring Boot or any other Java project.

How to Use

  1. Paste your JSON into the left panel. Java class definitions are generated instantly on the right. Click "Sample" to see an example.
  2. Enter a class name in the "Root class name" field (default: Root).
  3. Enter a Java package name in the "Package name" field (e.g. com.example.model).
  4. Enable "Use Lombok annotations" to add `@Data`, `@NoArgsConstructor`, and `@AllArgsConstructor` to each class.
  5. Enable "Use Jackson @JsonProperty" to add `@JsonProperty` annotations when the JSON key differs from the Java field name.
  6. Enable "Make fields private" to use the `private` modifier and auto-generate getter/setter methods (skipped when Lombok is enabled).

FAQ

How are nested objects handled?

Each nested object is converted into its own named Java class and referenced as a field type in the parent class. Classes are output in dependency order so the result can be used directly in a Java project.

How are arrays handled?

Arrays are typed as `List<T>`. For arrays of objects, all keys across all elements are merged into a single class and output as `List<ClassName>`.

What happens when Lombok is disabled?

When "Make fields private" is enabled without Lombok, getter and setter methods are automatically generated for each field.

How are null fields handled?

Fields with null values are typed as `Object`. You can manually change the type after generation once you know the actual expected type.