Skip to main content
Back to Tools
Web Tools

JSON to Kotlin Data Class

Convert JSON data to Kotlin data class definitions. Infer nested classes, List types, nullable types, and SerializedName annotations. Runs entirely in your browser — your data never leaves your machine.

json kotlin converter data-class code-generator android

Published May 29, 2026

All interactive tools run entirely in your browser. Your data never leaves your device.

How It Works

Paste any JSON data and instantly get Kotlin data class definitions. The tool infers types from values, handles nested objects, arrays, null values, and mixed types. Configure the root class name, val vs var modifier, data class vs plain class, and optional @SerializedName annotations for Gson/Moshi compatibility.

Features

  • Data class generation: data class Root(val name: String) by default
  • camelCase properties: Kotlin-idiomatic naming, with snake_case and kebab-case keys converted automatically
  • Nullable types: toggle Any? for null JSON values
  • val / var modifier: choose immutable or mutable properties
  • @SerializedName annotations: add Gson/Moshi serialization annotations when key names differ from camelCase
  • Nested class inference: objects within objects generate separate named data classes
  • Accurate type mapping: String, Int, Double, Boolean, Any?, List<T>
  • List handling: homogeneous arrays get typed elements, mixed arrays use List<Any>
  • 5 example payloads: simple, nested, array, API response, Android model
  • Private: runs entirely in the browser — no data transmitted

Use Cases

  • Quickly generating Kotlin model classes for API response data
  • Bootstrapping Android app data models from JSON fixtures
  • Converting JSON config files to typed Kotlin data classes
  • Learning how JSON structures map to Kotlin types
  • Generating Gson/Moshi-compatible data classes with serialization annotations