AIWalay Tools

JSON to Java Class Converter

Generate Java classes from sample JSON — typed fields with getters and setters, nested classes and List<T> for arrays. Copy or download.

About the JSON to Java Class Converter

This tool converts a JSON sample into Java classes (POJOs). It produces private fields with matching types, public getters and setters, nested classes for embedded objects, and List<T> for arrays — everything you need to deserialize JSON with Jackson or Gson.

Hand-writing model classes for a large API response is slow and easy to get wrong; generating them from real data is instant and complete. Object shapes are merged across array items so the classes cover every field in the sample.

Everything runs in your browser, so your JSON stays on your machine.

How to Use the JSON to Java Class Converter

  1. 1Paste a representative JSON sample.
  2. 2Set the root class name and optional package.
  3. 3Click Generate to produce the Java classes.
  4. 4Copy the code or download it as a .java file.

Frequently Asked Questions

Which JSON library do the classes work with?

Jackson and Gson both bind to standard POJOs with getters and setters, so the generated classes work with either. If your JSON keys differ from Java field names, add @JsonProperty (Jackson) or @SerializedName (Gson) annotations to map them.

What Java types are used?

Whole numbers become int or long, decimals become double, booleans become boolean, strings become String, objects become nested classes, and arrays become List<T>. Field names are camelCase per Java convention, derived from the JSON keys.

Does it generate getters and setters?

Yes. Each field gets a public getter and setter following JavaBean naming (getName/setName), which is what Jackson, Gson and most frameworks expect for binding. You can delete them if you prefer records or Lombok.

How are nested and repeated structures handled?

Nested objects become their own classes referenced by the parent. Arrays of objects generate an element class and a List<T> field. Objects appearing multiple times in an array are merged into one class with the union of their fields.

Is my JSON sent anywhere?

No. Generation happens entirely in your browser, so the sample JSON is never uploaded. It's safe to paste real responses while building your models.

Related Tools