About JSON to Kotlin
Kotlin data classes map onto JSON objects neatly, and its null safety makes the optional-versus-nullable distinction something the compiler enforces rather than something you remember.
Fields missing from some array elements are emitted as nullable with a default of null, so deserialising an object that lacks them succeeds instead of throwing. Getting this wrong is the usual cause of a crash on a response that was perfectly valid.
Keys that are not valid Kotlin identifiers are camel-cased and given a @SerialName annotation carrying the original key, so the renamed property still reads the right value.
How to generate Kotlin types
Paste your JSON
A whole array is better than one object — more samples means a more accurate type.
Name the root type
Nested objects are named automatically from the keys that hold them.
Copy the definitions
Types are emitted children first, so the file compiles in order.