JSON to Kotlin Converter

Generate Kotlin data classes from JSON. Paste your JSON:

Loading...
Loading...

Generate Kotlin Data Classes

This tool converts JSON to Kotlin data classes with support for popular serialization libraries: kotlinx.serialization, Moshi, and Gson.

Example Output

@Serializable
data class User(
    val id: Int,
    @SerialName("user_name") val userName: String,
    val email: String,
    @SerialName("is_active") val isActive: Boolean
)

Serialization Options

LibraryAnnotationBest For
kotlinx.serialization@SerializableKotlin Multiplatform, modern projects
Moshi@JsonAndroid, Square ecosystem
Gson@SerializedNameLegacy Android projects

Type Mapping

JSONKotlin
stringString
integerInt / Long
decimalDouble
booleanBoolean
nullString?
arrayList<T>
objectNested data class

Related Tools