Generate a Kotlin data class from JSON
Paste a JSON object to automatically generate the matching Kotlin data classes, with recursive type inference (String, Int, Double, Boolean, List, nested classes). No data is sent to a server.
How it works
The tool recursively analyzes each JSON property: strings become String, whole numbers Int, decimal numbers Double, booleans Boolean, and each nested object generates its own data class, named after the key that contains it and referenced from the parent class.
How are "null" values or empty lists typed?
A null value doesn't allow a precise type to be inferred: the field is generated as Any? with a default value of = null, to be adjusted manually once the real type is known. Likewise, an empty array becomes List<Any?>, since there is no element to infer the content type from.
Are key names with underscores converted?
Yes: a JSON key such as user_name is automatically converted to userName to follow the usual camelCase convention in Kotlin.
Privacy: your JSON is analyzed and transformed directly in your browser, with no network request.