Skip to main content

JSON to Kotlin

New

Generate Kotlin data classes with Gson annotations from JSON data.

convertkotlindata-class
Read the guide
Shortcuts:⌘ KSearch
Properties are normalized to camelCase.
@SerializedName is added only when required.
Continue with:

Frequently Asked Questions

Why did my JSON keys become camelCase properties?

Property names are normalized to camelCase for Kotlin. If that changes the original key, the tool adds @SerializedName so Gson can still bind the JSON correctly.

How are nulls represented?

If the sample contains null for a field, the generated type becomes nullable and the constructor parameter gets = null.

What types does it choose for numbers and arrays?

Integers become Long, decimals become Double, and empty arrays fall back to List<Any>.

Will it inspect every object in an array?

It merges schemas across array items, but a key missing from one object does not become optional automatically. Only sampled nulls make a property nullable.

What happens for top-level primitives or arrays?

Those become a typealias instead of a data class. Object roots become data classes.

Related Tools