About the JSON to Java Class Converter
This is a simple client-side tool that turns JSON into Java source code. You use it to create quick DTOs, test stubs or example models. The tool offers three output styles: a standard class with getters and setters, a Java 16+ record, or a Lombok @Data class. Conversion runs entirely in your browser and nothing you paste is uploaded. You can copy the generated code with one click, open a .json file, or download the .java file. The tool keeps the interface small so you can convert a JSON sample in seconds. For production build-time generation or schema-driven projects, consider jsonschema2pojo or a CLI tool. The converter follows RFC 8259 JSON parsing and common mapping rules for objects, arrays, numbers, booleans and nulls.
How to use it
- 1Paste or type your JSON into the input area.
- 2Choose output style: Class with getters and setters, Record (Java 16+), or Lombok @Data.
- 3Click Generate to view the Java source.
- 4Click Copy to copy to clipboard or Download to save a .java file.
Worked example
Input JSON: { "id": 42, "name": "Widget", "price": 9.99 } Generated Java class (Class with getters and setters): public class Product { private int id; private String name; private double price; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } }
How it works
Text tool that runs in the browserOptions: Class with getters and setters, Record (Java 16+), Lombok @DataOne click copies the outputVisitors can also open a file and download the resultNothing typed is uploadedSource: RFC 8259 - The JSON Data Interchange FormatJSON Schema - json-schema.orgJakarta JSON Binding (JSON-B) specification. Last checked 6 November 2026.
What it is good for
- Runs entirely in your browser, so no upload.
- Three output styles: POJO, Record, or Lombok @Data.
- Copy with one click or download a .java file.
- No advanced generator options like Jackson annotation toggles or date auto-detection.
- Not intended for build-time schema generation in CI pipelines.
Questions people ask
Does the tool upload my JSON to a server?
No. The conversion runs in your browser and nothing you paste is uploaded. If you need extra privacy, convert on an offline machine or use a local CLI tool.
Which Java version do records require?
Records require Java 16 or newer. If you pick the Record option, the tool emits a record declaration that will not compile on older Java versions.
How does the tool map JSON numbers?
Integers produce int when values fit 32 bits and decimals produce double. The tool follows common mapping rules; check the generated types and adjust them for your project.
What does the Lombok option require?
The Lombok @Data output requires Lombok on your project classpath and the Lombok annotation processor enabled in your build or IDE. The generated source uses Lombok annotations rather than explicit getters and setters.
How are arrays handled, especially mixed arrays?
The tool maps arrays to java.util.List of the inferred element type. If elements mix shapes or types, the element type widens to Object and you get List<Object>.
Can I open a JSON file directly?
Yes. You can open a .json file instead of pasting. After opening the file, click Generate and then Copy or Download the output.
Help keep every tool free
FreeToolr stays free because people help it grow. Share a tool you like, tell us what to build next, or support us on Ko-fi.