Generate Kotlin data classes with kotlinx.serialization annotations from a typical REST API JSON response. Paste your API output and get typed Kotlin code.
// Generated by DevBento — json-to-typescript
interface RootAddress {
street: string;
city: string;
zip: string;
}
interface RootPostsItem {
title: string;
likes?: number;
}
interface Root {
id: number;
name: string;
email: string;
isActive: boolean;
roles: string[];
address: RootAddress;
posts: RootPostsItem[];
}This example generates Kotlin data classes with kotlinx.serialization annotations from a typical REST API response. The pre-filled JSON represents a user object with nested address, array of roles, and array of post objects. Switch to Kotlin mode to see the generated classes.
The tool produces:
Root data class with @Serializable and @SerialName annotationsRootData class for the nested address objectRootPostsItem class for array items@SerialName("key") attributes on every propertyT?) with null defaults for optional fieldsString, Long, Double, Boolean, List<String>Kotlin data classes with kotlinx.serialization are the standard way to deserialize JSON in Android and Kotlin Multiplatform projects. The generated code works directly with Json.decodeFromString<T>(string). Use nullable types with null defaults for fields that may not always be present in the response.
Nothing you paste leaves this tab. Every tool runs entirely in your browser — no upload, no server, no account.