Convert JSON to Kotlin Data Class
Paste a JSON payload and get Kotlin data classes with correct property types, nullable fields, and List<T> for arrays — ready to drop into an Android or Ktor project. Everything runs locally in your browser; your JSON never leaves your device.
JSON Source
Kotlin Data Class
Ready.
How to use
- Paste your JSON object (or an array to infer the element type) into the input panel.
- Click Convert to Kotlin — the data classes are generated entirely in your browser.
- Review the properties: nullable types (T?) for optional fields, List<T> for arrays, nested data classes for objects.
- Paste the classes into your project and annotate for kotlinx.serialization or Moshi as needed.
Common use cases
- Modelling a REST API response as Kotlin data classes for Retrofit/Moshi on Android.
- Generating serializable models for a Ktor server without hand-writing each class.
- Turning sample JSON into typed classes for tests instead of parsing maps.
Frequently asked questions
- Are the classes nullable-aware?
- Yes — fields that are null or missing in the sample become nullable Kotlin types (T?), and arrays become List<T>.
- Will it work with kotlinx.serialization or Moshi?
- Yes — the data classes are plain and idiomatic, so you only add the serializer annotation your library needs.
- Is my JSON uploaded anywhere?
- No. Conversion runs 100% client-side via WebAssembly, so it works offline and on sensitive data.