PasteZap
🌐 English
Free · No account

FREE · DEVELOPER TOOLS

JSON to Kotlin Data Class.

Turn a JSON sample into Kotlin data classes for kotlinx.serialization, with @SerialName for keys that are not camelCase and nullable optional fields.

Limits & supported formats

Types are inferred from the sample only. Everything is calculated in your browser; nothing you type is uploaded.

Loading the calculator…

How to use JSON to Kotlin Data Class

Paste a JSON object or an array of objects and name the root class. Copy or download Models.kt.

How it works

Integers map to Long, decimals to Double, lists to List<T> and varying values to JsonElement. Kotlin keywords are escaped with backticks.

Example

user_name becomes @SerialName("user_name") val userName: String; a coupon present in only one order becomes String? = null.

Questions about JSON to Kotlin Data Class

Is JSON to Kotlin Data Class free, and do I need an account?

Yes. This tool is free to use in your browser without an account. Processing takes place on your device.

What are the limits and what should I check?

Types are inferred from the sample only. Everything is calculated in your browser; nothing you type is uploaded. Review the result before using it in your work.

Is my input sent to a server?

Your input is processed in your browser and is not uploaded by this tool. Files and pasted text are cleared when the page is refreshed. Normal website requests are still required to load the page and its libraries. Read the privacy explanation.