JSON to Java
Generate Java classes with getters, setters and nested static classes from JSON.
Generate Java classes
Result: —
How to use the JSON to Java
- Paste a JSON sample into the input box.
- Set the name of the root class.
- Click Generate classes and copy the Java source.
Features
- Private fields with getters and setters
- Nested objects become static inner classes
- Arrays become List types with the right imports
- Null values use boxed types instead of primitives
Advertisement
Frequently Asked Questions
Common questions about the free online json to java.
Paste a JSON sample, choose the root class name and click Generate classes. You get fields,
getters, setters and nested static classes.
Keys become camel case fields, so a key such as first name turns into firstName with a
getFirstName getter and a setFirstName setter.
Every nested object becomes a public static inner class named from the key path, so an
address inside a user object becomes UserAddress.
Arrays become List types with the matching element class, and the java.util.List import is
added at the top of the generated file.
A field that can be null uses a boxed type such as Integer or Double instead of a primitive,
so a missing value stays legal.
No. The generated code only uses java.util.List, so it compiles with a standard Java
development kit and no build changes.
No. The classes are generated locally in your browser and nothing is sent anywhere.
Invalid JSON, or a sample that is neither an object nor an array, produces a clear error
message instead of code.
Last updated: October 10, 2026