JSON to Java

Generate Java classes with getters, setters and nested static classes from JSON.

Generate Java classes

Result: —
Nested objects become public static inner classes, and every field gets a getter and a setter.

How to use the JSON to Java

  1. Paste a JSON sample into the input box.
  2. Set the name of the root class.
  3. Click Generate classes and copy the Java source.

Features

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