data class with val or var?
The generator emits val (read-only) properties by default because that is the idiomatic Kotlin choice for DTOs — immutable models prevent accidental mutation, work safely across threads, and make the data class .copy() function meaningful. If you need mutable models (e.g. for ViewBinding two-way binding) change val to var manually after copying. data class equality and hashCode work identically with val or var.
Does it support kotlinx.serialization?
Yes. The generated data class is compatible — add @Serializable above each class and Json.decodeFromString<Root>(jsonString) works directly. For JSON keys that do not match Kotlin property names use @SerialName("original_key") on the property. Make sure org.jetbrains.kotlinx.serialization plugin is applied in your build.gradle.kts.
How do I deserialize the generated data class?
With kotlinx.serialization: val root = Json.decodeFromString<Root>(jsonString). With Moshi: val adapter = moshi.adapter(Root::class.java); val root = adapter.fromJson(jsonString). With Retrofit: declare suspend fun fetch(): Root and let the converter factory handle it. All three work because the data class has a primary constructor matching the JSON keys.
How are nullable types handled?
JSON null in the sample produces Any? on the Kotlin side; concrete non-null values produce non-nullable types like String, Int, Boolean, Double. To express an optional field, change String to String? after copying — kotlinx.serialization then accepts the field being absent in the JSON if you also add a default value (val name: String? = null).
How are nested JSON objects modelled?
Each nested object becomes its own top-level Kotlin data class so you can split them into separate .kt files. The parent data class holds a typed reference (val address: Address) and kotlinx.serialization or Moshi recurse automatically when both classes are annotated.
How are JSON arrays of objects mapped?
Arrays of objects become List<DataClassName>. Arrays of primitives become List<String>, List<Int>, List<Double>, or List<Boolean>. kotlinx.serialization and Moshi both handle Kotlin List<T> with no extra adapters required.
Can I use this with Android and Retrofit?
Yes. Drop the data classes into your Android project and declare a Retrofit interface like @GET("users/{id}") suspend fun getUser(@Path("id") id: Int): User. Wire either a Moshi or kotlinx.serialization converter factory in your Retrofit.Builder and Retrofit deserializes responses directly into the data class.
Is the JSON uploaded to your servers?
No. Conversion runs entirely in your browser via JavaScript. Open DevTools → Network and click Convert — no requests are made. JSON containing API keys, internal field names, or PII never leaves your machine.