How to use the JSON to Java POJO Converter
- 1. Paste your JSONUse a sample API response or any JSON object.
- 2. Choose a stylePick plain getters and setters, Lombok or a Java record.
- 3. Copy the classesPress Convert and copy or download the .java file.
How types are worked out
The converter reads each value in your JSON and picks a Java type:
- Text becomes
String. - Whole numbers become
int, orlongif bigger than 2,147,483,647. - Decimals become
double; true/false becomesboolean. - Nested objects become their own static nested class.
- Arrays become
List<T>, with T taken from the items; arrays of objects get a class named in the singular (projects → Project). nullbecomesObject, because the real type cannot be guessed.
Keys that are not valid Java names are converted to camelCase, and an @JsonProperty annotation keeps the original name, so pin_code becomes the field pinCode with @JsonProperty("pin_code").
Worked example
The sample JSON describes an employee with an id, name, active flag, salary, a skills array, an address object and a projects array. Converting it with the root name Employee gives 3 classes and 11 fields:
Employee: int id, String name, boolean isActive, double salary, List<String> skills, Address address, List<Project> projects (7 fields)Address: String city, String pinCode (2 fields)Project: String title, int year (2 fields)
Pick Lombok to replace the getters and setters with @Data, which is common in Spring Boot projects. Pick record for Java 16 and later when you want immutable data carriers. Tick wrapper types if a value can be missing, because Integer can hold null and int cannot.
Frequently asked questions
Do I need Jackson to use these classes?
Only if you keep the @JsonProperty lines or want to parse JSON with Jackson. Spring Boot includes Jackson by default.
What happens with an empty array?
It becomes List
Is my JSON uploaded anywhere?
No. The conversion runs in your browser with JavaScript's own JSON parser.
Is the converter free?
Yes, completely. You give your name and WhatsApp number once when you convert for the first time, and all Uncodemy tools then work without the form.