JSON to Kotlin Data Class
Generate Kotlin data classes from JSON. Supports kotlinx.serialization, Gson, and Moshi annotations with proper type inference.
Features
🎯 Idiomatic Kotlin
- Data class generation
- Proper Kotlin type mapping
- Nested class support
- Null-safe types with ?
📦 Multiple Libraries
- kotlinx.serialization
- Gson annotations
- Moshi annotations
- Automatic @SerialName
⚡ Smart Type Inference
- Int vs Double detection
- List<T> for arrays
- Nested object classes
- Optional nullable fields
Kotlin Data Class Guide
Kotlin Data Classes with Serialization
Kotlin data classes are the idiomatic way to model JSON data. With kotlinx.serialization, you get compile-time safe serialization.
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerialName
@Serializable
data class User(
val id: Int,
val name: String,
@SerialName("is_active")
val isActive: Boolean
)