JSON to Kotlin Converter
Generate Kotlin data classes and Jackson mappings from JSON, with nested models, nullable fields and a downloadable source file.
How to generate Kotlin models
Try a root type such as SearchResult and review the generated data classes for nested items. Copy one file when you only need the model, or download the ZIP for the complete output.
Complete output uses Jackson 2.x (2.12 or later) with the Kotlin module; install matching jackson-databind and jackson-module-kotlin dependencies. Keep the quicktype package or update it consistently. Models-only data classes omit JSON mappings, so renamed fields require your own serialization configuration. The generated Jackson mapper omits null properties when serializing.
Samples, optional fields and limits
Keep strings as strings when preparing Kotlin 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 Kotlin?
Use JSON Lines to include a response with null and one without the key. Review the inferred nullable properties before relying on the generated Jackson mapper’s treatment of null during serialization.
Does the page compile these Kotlin classes?
The browser infers Kotlin models from pasted samples. The generated classes are not compiled or sent with your JSON to a remote service.
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 Kotlin nullable/nested data classes and Jackson names 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 Kotlin keeps Jackson mappings, nullable fields and nested data classes
These checks cover the listed examples and boundaries, not every possible input. Round trips and checks using the same library are not independent verification.