JSON to Java Converter
Generate Java classes, lists and Jackson JSON converters from nested JSON samples. Keep original field names through serialization mappings.
How to generate Java models
Name the root class, such as ApiResponse, and use the file selector to review nested Java classes and the converter separately. Download the ZIP to keep the generated class filenames together.
Complete output uses Jackson 2.x Databind and its annotations on Java 8 or later; add that dependency in your project. Keep each public class in the filename shown and the io.quicktype package. Models-only output has getters/setters but omits Jackson mappings and converters.
Samples, optional fields and limits
Keep strings as strings when preparing Java samples, even for IDs, dates and UUIDs. Treat the result as a model inferred from examples. Limits are 200,000 input characters, 64 nesting levels, 50 samples, 50 files and 1,000,000 output characters. The local worker can be cancelled and has a 10-second deadline.
Questions & answers
How should I sample missing and null fields for Java?
If a response sometimes omits a field, include that version alongside the populated response in JSON Lines. A JSON null is different from an absent property. Compare the Java types before adding the classes to your project.
Does the tool send my JSON to a Java service?
Sample parsing and Java source generation run in the browser. Remote schemas are not fetched and Jackson code is not executed here.
Other Languages
References
How we make sure
We check this tool with the automated test suites linked below. Example checks are shown in their original language.
- Verification method
- Check generated Java class-file separation, original JSON names and field types against fixed JSON fixtures.
- Comparison reference
- Explicit declaration/field-mapping assertions and generator integration.
- Verification scope
- These cases are not all claimed to invoke the target-language compiler.
Test source and cases (select a file to read it)
-
code-tools.test.js
- JSON to Java emits distinct public class files, escaped JSON mappings and compilable model declarations
These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.