JSON to Kotlin Data Class Converter

Instantly convert JSON objects into clean Kotlin data classes with kotlinx.serialization, Moshi, Jackson, or Gson annotations.

At a glance

JSON to Kotlin Converter is a free web tool that converts JSON to idiomatic Kotlin data classes online. It generates clean, concise data classes with immutable val or mutable var properties. It also detects primitives (Int, Long, Double, String, Boolean), lists (List<T>), and child data classes. All processing is local: nothing is uploaded, and no account is required.

Universal Switcher:
From:
To:

100% Client-Side In-Browser JSON to Kotlin Converter

Generate idiomatic Kotlin data class models with kotlinx.serialization, Moshi, Jackson, Gson, or plain syntax. 100% private in browser memory.

Local & Private Instant Conversion
JSON Input 0 B
Ready
Auto-evaluates on keystroke
Kotlin Code kotlinx.serialization
// Paste JSON on the left to generate Kotlin data classes...
0 data classes kotlinx
Kotlin 1.9+ / 2.0+ Ready
Gradle & Maven Dependencies kotlinx.serialization
// Gradle (Kotlin DSL)
plugins {
    kotlin("plugin.serialization") version "2.0.0"
}

dependencies {
    implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
}
Kotlin Data Classes

Clean, concise data class generation with immutable val properties and safe backtick escaping.

Multi-Framework Serialization

Supports kotlinx.serialization, Square Moshi, Jackson, Google Gson, or Plain Kotlin.

100% Client-Side Privacy

Execution happens entirely in local browser memory with zero network transmissions or cloud logging.

Why Use This JSON to Kotlin Converter?

Idiomatic Kotlin Data Classes: Generates clean, concise data classes with immutable val or mutable var properties.
Multi-Framework Serialization: Seamlessly switch between kotlinx.serialization, Square Moshi, Jackson, Google Gson, or Plain Kotlin.
Kotlin Keyword Escaping: Automatically escapes colliding property names with backticks (`val`, `class`, `is`, `when`, etc.).
Smart Type Inference: Detects primitives (Int, Long, Double, String, Boolean), lists (List<T>), and child data classes.
Configurable Nullability: One-click option to mark properties nullable (?) and include sensible default values.
100% In-Browser Privacy: All parsing and Kotlin code generation execute strictly inside your local browser memory.

How to Use JSON to Kotlin Converter

1

Paste Your JSON

Paste your JSON payload into the input editor or choose one of the preset samples.

2

Configure Kotlin Options

Choose between kotlinx.serialization, Moshi, Jackson, Gson, or plain data classes, and configure nullability.

3

Copy or Download Kotlin Code

Click 'Copy' to copy the generated Kotlin data classes or download them as a .kt file.

Worked example: JSON to Kotlin Converter

Executed entirely inside your local browser memory using modern Web APIs. The engine verifies input syntax, performs deterministic transformation, and exposes instant copy or download options.

Sample JSON Data Source
sample_payload.json (Valid format conforming to JSON specification)
Resulting KT Output Processed
converted_result.kt (100% client-side)

Technical Specifications & Engine Details

Technical specifications and engine details for JSON to Kotlin Converter
Specification Details
Supported Formats JSON, TEXT → KT, KOTLIN, TEXT
Execution Mode 100% Client-Side In-Browser (client)
Browser Requirements Requires modern web browser with ECMAScript 6+ and standard DOM Web APIs.
Performance Constraints Client browser memory limit (typically 1–2 GB RAM); processing speed depends on local device CPU.
Maintained by Pragyan Pahadi

100% Client-Side Privacy Guarantee

All JSON parsing and Kotlin code generation execute 100% locally in your browser memory. Your data never leaves your device.

Frequently Asked Questions

How does this tool convert JSON to Kotlin data classes?
It recursively parses your JSON object, infers types, converts keys to camelCase properties, and generates complete Kotlin data classes with framework annotations.
Which Kotlin serialization frameworks are supported?
The converter natively supports kotlinx.serialization (@Serializable, @SerialName), Square Moshi (@JsonClass, @Json), Jackson (@JsonProperty), Google Gson (@SerializedName), and plain Kotlin.
How does it handle reserved Kotlin keywords in JSON fields?
If a JSON key is a reserved keyword like 'val', 'class', or 'is', it is safely escaped with Kotlin backticks (`val`, `class`) so the code compiles without errors.
Can I generate immutable val or mutable var properties?
Yes! Use the val / var toggle in the toolbar to generate either immutable val properties (recommended) or mutable var properties.

Methodology

Rankings and recommendations here are never paid for.

Last updated .