#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · INSTANT CODE

JSON to Java POJO: Turn Any JSON into Java Classes

Paste JSON and get Java classes with the right types, nested classes and annotations.

  • ☕ Getters/setters, Lombok, records
  • 🪆 Nested classes and lists
  • 🏷️ Jackson @JsonProperty

How to use the JSON to Java POJO Converter

  1. 1. Paste your JSONUse a sample API response or any JSON object.
  2. 2. Choose a stylePick plain getters and setters, Lombok or a Java record.
  3. 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, or long if bigger than 2,147,483,647.
  • Decimals become double; true/false becomes boolean.
  • 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).
  • null becomes Object, 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 because there is no item to read the type from. Add one sample item to get a proper class.

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.

More free tools

See all free tools