JSON to Kotlin Data Class Generator

Generate idiomatic Kotlin data classes from JSON API responses for Android, Retrofit, Moshi, and kotlinx.serialization.

How It Works & Reference

Select Kotlin in the target format dropdown and paste any JSON response. Nested objects become separate Kotlin data classes and JSON arrays map to immutable List<T> properties ready for Retrofit or kotlinx.serialization.

Frequently Asked Questions

Does it support deeply nested Android API response wrappers?

Yes, recursive traversal generates cleanly named data classes for every nested level.

Are integers mapped to Int or Long?

Standard integers map to Int while 64-bit timestamps/IDs exceeding 32-bit range automatically upgrade to Long.

Can I use the output with Gson and kotlinx.serialization?

Yes, just add @Serializable or @SerializedName annotations where snake_case field mapping is needed.

Related Tools