JSON to Kotlin
Generate Kotlin data classes with nullable types from a sample JSON document.
Generate Kotlin data classes
Result: —
How to use the JSON to Kotlin
- Paste a JSON sample into the input box.
- Set the name of the root data class.
- Click Generate classes and copy the Kotlin code.
Features
- Data classes with camel case property names
- Nullable types for values that can be null
- Arrays become List types with element classes
- One class per object shape, named from the key path
Advertisement
Frequently Asked Questions
Common questions about the free online json to kotlin.
Paste a JSON sample, set the root class name and click Generate classes. Every object shape
becomes a data class with typed properties.
Text becomes String, whole numbers become Int or Long, decimals become Double, booleans
become Boolean and arrays become List types.
A field that can be null gets a question mark, so text becomes String with a question mark
and unknown values become Any with a question mark.
A data class needs at least one property, so an object with no keys is emitted as a plain
class instead, which still compiles cleanly.
Nested objects become their own classes named from the key path, so an address inside a user
object becomes UserAddress.
Keys are converted to camel case property names, and reserved words get a Value suffix so the
generated code always compiles.
No. Generation happens entirely in your browser, so your document stays on your device and is
never stored.
Text that is not valid JSON, or a sample that is neither an object nor an array, shows a
clear error message instead of code.
Last updated: October 10, 2026