JSON to Kotlin
About this tool
Hand-writing Kotlin data classes from a payload misses fields. Paste JSON to generate classes. Enable Gson, Moshi, or kotlinx.serialization as needed. Use the online cURL generator for HTTP commands.
Features
- Emits data classes
- Optional Gson, Moshi, or kotlinx.serialization
- Nested JSON becomes extra classes
How to use
- Paste a JSON sample and set the class name, for example User.
- Optionally enable Gson, Moshi, or kotlinx.serialization.
- Copy the data class into your Android project.
When to use it
- Android DTOs from an API sample
- The app already uses Moshi or kotlinx.serialization
- Generate first, then tighten nullability
Examples
- {"ok":true} becomes a Boolean property.
- kotlinx.serialization mode adds @Serializable.
FAQ
Is the JSON uploaded?
No. Generation stays in the browser.
How is this different from the online cURL generator?
This page builds a Kotlin data class from JSON. The online cURL generator turns an HTTP request into a curl command.
Back to JSON Tools Hub