JSON To Kotlin
Generate Kotlin data classes from JSON sample data with kotlinx.serialization and Jackson output modes.
Generate Kotlin data classes from JSON payloads
Kotlin projects often need strongly typed models for API responses, mobile sync payloads, and backend integrations. Hand-writing nested data classes for every JSON sample is repetitive and drifts quickly when fields change. This generator inspects your JSON sample and emits Kotlin data classes you can paste into Android, Ktor, or server-side Kotlin code.
What this tool does
Paste JSON in the input panel. The converter uses quicktype to infer nested object shapes and output Kotlin data classes with appropriate property types. You can set the root class name and choose between kotlinx.serialization and Jackson-oriented output styles.
Configuration options
- Root Class Name: Rename the top-level data class generated from your JSON sample.
- Kotlin Output Mode: Switch between kotlinx.serialization and Jackson-friendly output.
Common use cases
- Bootstrap Android or Ktor models from REST API responses.
- Create starter data classes before wiring JSON parsing in mobile apps.
- Document expected payload shapes for backend and mobile teams.
- Compare inferred models against OpenAPI or JSON Schema contracts.
Related tools
Need Java POJOs instead of Kotlin? Try the JSON to Java Converter. For TypeScript models, use the JSON to TypeScript POJO Generator or generate JSON Schema with the JSON to JSON Schema Generator.
Frequently Asked Questions
Does my JSON leave the browser?
No. Conversion runs entirely in your browser. Your JSON is never uploaded to a server, which makes the tool safe for internal API samples and production-like fixtures.
Which Kotlin serialization style should I choose?
Pick kotlinx.serialization when your project already uses the official Kotlin serialization plugin. Choose Jackson when your stack relies on Jackson annotations and databind integration.
Can I rename the root data class?
Yes. Use the Root Class Name field to control the top-level generated class. Nested helper classes keep names inferred from object keys in your JSON sample.
Are nullable fields supported?
The generator reflects values present in your JSON sample. A null
value in the sample can produce nullable types, but fields missing from the
sample are not marked optional automatically.
How is this different from the JSON to Java Converter?
Both tools infer models from JSON samples. This converter emits Kotlin data classes for Kotlin/Android projects, while the JSON to Java Converter produces Java classes with getters and setters.