JSON to Kotlin Data Class
JSON → Kotlin data classes. Int/Long are chosen by magnitude, nested objects become their own class, and identical shapes are reused instead of duplicated.
JSON to Kotlin Data Class — Free Online Tool
Generates Kotlin data classes from a JSON sample with kotlinx.serialization annotations, choosing Int or Long by magnitude, Double for decimals, nullable types with defaults for JSON nulls, and adding @SerialName only when the camelCase property differs from the wire key, while reusing one class for repeated object shapes.
How to use the JSON to Kotlin Data Class
- Open the tool above — it runs entirely in your browser, so your input never leaves this page.
- Paste or type your input into the field, then press the relevant button (e.g. Encode / Decode, Generate, or Convert).
- Copy the result from the output area with the copy button orCtrl/Cmd + C.
- No signup, no upload, and no tracking — repeat as often as you need.
Frequently asked questions
When do I need the @SerialName annotation?
Only when the JSON key differs from the Kotlin property. Kotlin properties are camelCase, so a user_name key needs @SerialName("user_name") on userName; keys that are already camelCase need no annotation and none is emitted.
How does it choose between Int and Long?
By magnitude. Whole numbers that fit in a signed 32-bit range become Int; anything larger becomes Long, which matters for epoch-millisecond timestamps and Snowflake-style IDs.
What happens to null values in the sample?
A null gives no type information, so the property becomes String? with a null default. Replace it with the real type once you know it — a sample payload cannot tell you what a null field would have contained.
Free & private — why use this JSON to Kotlin Data Class
The JSON to Kotlin Data Class runs 100% client-side in your browser. Your data is never uploaded to a server, no account is required, and the tool is completely free. It works offline once the page has loaded and is part of a growing collection of privacy-first developer utilities.