JSON to Kotlin Data Class
Generate Kotlin data classes from JSON, for kotlinx.serialization, Gson, or plain Kotlin.
Runs in your browser. Nothing is uploaded.
Input
Waiting for JSON
Kotlin
Kotlin types appear here.What this does
Paste JSON and get Kotlin data classes for it. Pick kotlinx.serialization (@Serializable), Gson (@SerializedName), or plain classes with no annotations.
Nullable and optional
A key that is missing from some items, or sometimes null, becomes a nullable type with a default of null, like val note: String? = null. Whole numbers are Long, decimals Double.
Names
Properties are camelCase. When that differs from the JSON key (first-name → firstName) the original key is kept in a @SerialName or @SerializedName annotation. Two objects with the same shape share one class.
More json tools
All- JSON to TypeScriptTurn any JSON into TypeScript interfaces. Nested types named, optional keys detected.
- JSON to Go StructGenerate Go structs with json tags from any JSON. Nested structs named, pointers for nullable values.
- JSON to Java ClassGenerate Java records or POJO classes with Jackson annotations from any JSON.
- JSON to Python DataclassGenerate Python dataclasses, Pydantic models, or TypedDicts with type hints from any JSON.
- JSON to C# ClassGenerate C# classes for System.Text.Json or Newtonsoft from any JSON. Nullable types detected.
- JSON to Dart ClassGenerate null-safe Dart classes with fromJson and toJson from any JSON. Made for Flutter.
- JSON to Swift CodableGenerate Swift Codable structs with CodingKeys from any JSON.
- JSON to Rust StructGenerate Rust structs with serde derives and Option fields from any JSON.