How the types are inferred
The generator reads your sample and infers a type for every field: strings, integers and decimals, booleans, nested objects (each gets its own named Kotlin type) and arrays. If an array holds several objects, all of them are merged — fields missing from some items become optional and fields that are sometimes null become nullable, so one representative response is usually enough. Field names that aren’t valid identifiers are converted and mapped back to the original JSON key.
Using the Kotlin code
Data classes are annotated for kotlinx.serialization: decode with Json.decodeFromString<Root>(text). Nullable or optional properties are typed with ? and default to null, so missing keys don’t throw. Using Moshi or Gson instead? Replace @SerialName with @Json(name = …) or @SerializedName. Works for Android and Kotlin Multiplatform projects.
Everything runs in your browser — your code and data are never uploaded, so it is safe to paste private config files and API responses.
Frequently asked questions
Do I need the serialization plugin?
Yes — apply the kotlinx.serialization Gradle plugin and library.
Why do some properties default to null?
They were optional or null in the sample, so missing values don’t cause errors.
Can I use this with Retrofit?
Yes, with the kotlinx.serialization converter.
Last updated 2026-11-21 · Built by Vinayak Agarwal · Part of Developer & Web (77 tools)