JSON to Java POJO Generator
Generate standard Java POJO classes with Jackson annotations and Lombok @Data from JSON.
- 100% free
- Private in browser
- No signup
- No watermarks
Java POJO Classes (1)
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EmployeeDto {
@JsonProperty("employee_id")
private Long employeeId;
@JsonProperty("name")
private String name;
@JsonProperty("skills")
private List<String> skills;
}About JSON to Java POJO Generator
The JSON to Java POJO Converter generates Java classes from a sample JSON payload. Paste a response body, set the root POJO name, and the tool writes private camelCase fields, each annotated with Jackson @JsonProperty carrying the original key. Classes use Lombok @Data, @NoArgsConstructor, and @AllArgsConstructor instead of hand-written getters and setters. Whole numbers become Long, decimals become Double, and arrays become List<T>. Types come from the single sample you paste, so check them.
How to use JSON to Java POJO Generator
- Enter a root POJO name, such as EmployeeDto.
- Paste your sample JSON into the Input JSON box.
- Review the fields and the class count in the Java POJO Classes panel.
- Click Copy Java Code and put each class in its own .java file.
Key features
- Private camelCase fields with @JsonProperty for the original key
- Lombok @Data, @NoArgsConstructor, and @AllArgsConstructor on every class
- Maps whole numbers to Long, decimals to Double, and booleans to Boolean
- Creates a separate class for each nested object, named after its key
- Types arrays as List<T> based on their first element
- Includes the Jackson, Lombok, and java.util.List imports
Frequently asked questions
- How do I convert JSON to a Java POJO?
- Paste your JSON into the Input JSON box, set a root POJO name, and the classes are generated instantly. Click Copy Java Code to copy them.
- Do I need Lombok to use the generated classes?
- Yes, as generated. Every class relies on Lombok for getters, setters, and constructors, and there is no switch to turn it off. Without Lombok, delete the three annotations and their imports, then generate getters and setters in your IDE.
- Why does the code not compile when I paste it into one file?
- Java allows only one public top-level class per file, and the output puts all classes in one block. Move each class into a file named after it, or make the nested ones static inner classes of the root.
- Which Java types are used for JSON numbers?
- Whole numbers become Long and numbers with a decimal part become Double. Both are wrapper types, so a missing key deserializes to null. Switch to Integer or BigDecimal by hand where that suits the data better.
- How are null values and empty arrays typed?
- A null value becomes Object and an empty array becomes List<Object>, because the sample has nothing to infer from. Replace them with the real type once you know it.
Related In-Depth Guides
Learn practical workflows, real-world examples, and expert tips in our comprehensive guides:
Password Entropy Explained: How Bits Measure Brute-Force Cracking Time
Understand Shannon entropy in passwords, character pool combinations, and how many seconds, years, or millennia it takes GPUs to crack modern passphrases.
How to Convert Docker Run Commands to Docker Compose YAML Files
A comprehensive developer guide to transforming complex docker run commands into clean, maintainable docker-compose.yml files.
Web Accessibility & Color Contrast (WCAG 2.1): How to Design AA & AAA Palettes
A practical guide to color contrast ratios, accessibility compliance, WCAG 2.1 AA/AAA standards, and building accessible UI palettes.
Rate this tool
Be the first to rate — helps others and improves this page.