450+ free calculators — no sign-up, no ads, no paywalls. Browse all tools →
Start typing to search...
Kotlin model generator

JSON to Kotlin Data Class Converter

Generate clean Kotlin data classes from representative JSON with nested models, list inference, nullable properties, serialization annotations, sensible defaults, and Android-ready output.

JSON Input

Kotlin Output

0 classes0 properties0 B

Local browser processing Full-sample inference No signup

How to Convert JSON to Kotlin Data Classes

Create typed Kotlin models from sample JSON in three simple steps.

STEP 01

Add representative JSON

Paste an object or array, or upload a valid .json file up to 10 MB.

STEP 02

Configure the model

Set the root name, annotations, property naming, nullable behavior, and default values.

STEP 03

Export Kotlin code

Review the inferred classes, copy them, or download a ready-to-edit .kt file.

Inference Designed for Kotlin Models

The generator examines every sampled object in an array, merges available keys, detects missing values, and infers Kotlin primitives, nested data classes, lists, and unions that safely fall back to Any.

JSON keys can become idiomatic camelCase properties while Kotlin serialization annotations retain their original names. Reserved words are wrapped in backticks, empty arrays become List<Any>, and explicit nulls can produce nullable types.

  • Infers String, Int, Long, Double, Boolean, lists, objects, and nullable types
  • Supports kotlinx.serialization, Gson, Moshi, or annotation-free output
  • Generates unique PascalCase model names and valid Kotlin properties
JSON
Kotlin

Professional Output for Android and Backend Work

Useful for API responses, Android apps, Ktor services, SDKs, fixtures, and typed data contracts.

Private generation

Your JSON stays in the browser and is never submitted to the website server.

Array-aware inference

Every sampled object contributes keys and types instead of relying only on the first item.

Reviewable models

Consistent formatting and explicit nullability make generated contracts easier to verify.

Frequently Asked Questions

Key details about inferred Kotlin data classes.

Which serialization annotations are supported?

You can generate kotlinx.serialization @SerialName, Gson @SerializedName, Moshi @Json, or plain Kotlin models.

How are arrays of objects handled?

All sampled objects contribute fields and types to a named item data class used inside a Kotlin List.

What happens to null and missing values?

Explicit nulls and fields missing from some records can become nullable types, with optional = null defaults.

How are invalid Kotlin property names handled?

Keys are converted to camelCase when enabled. Reserved words and unusual identifiers use safe backtick notation.

Can generated code be used immediately?

The syntax is ready to edit, but generated types reflect only the supplied sample. Compare them with the complete API schema before production use.

Is my JSON uploaded?

No. Parsing, inference, copying, and download creation happen locally in your browser.