JSON to Java

Paste JSON and instantly get matching Java POJO class definitions with getters, setters, and nested classes.

Use the JSON to Java

Input JSON

Java Output

Paste JSON and click Generate

Copied!

Summary

JSON to Java reads a JSON value and generates matching Java class definitions, including private fields, public getters and setters, and separate classes for nested objects. When an array of objects is scanned, fields are gathered across every item so the generated class covers keys that only appear on some entries. Field names are converted to camelCase and the original JSON key is noted in a comment whenever it differs from the Java field name, so the mapping stays clear even without a JSON binding library.

How it works

  1. Paste or type JSON into the input panel, or load a sample.
  2. Set a root class name (defaults to RootObject).
  3. Click Generate to parse the JSON and build Java classes.
  4. Nested objects become their own named classes; arrays of objects are scanned across all items to collect every field.
  5. Review the generated classes, each with private fields plus getters and setters, in the output panel.
  6. Click Copy to copy the Java code to your clipboard.

Use cases

  • Scaffold a POJO for an incoming REST API response before writing a deserializer.
  • Turn a sample config file into a typed Java settings class.
  • Generate a starting class for Jackson or Gson without typing every field by hand.
  • Document a third-party API response shape as Java types.
  • Speed up building a Java client for an API that only ships JSON examples.
  • Check field naming and nesting before hand-writing a data model.

Frequently Asked Questions

Last updated: 2026-07-13 · Reviewed by Nham Vu