JSON → Kotlin data classes

Client

Paste JSON to get data class declarations with inferred property types— wire to your serializer of choice in the IDE.

Learn more: JSON and Kotlin

Generate data class declarations with `val` properties from sample JSON—adjust nullability and serializers (kotlinx.serialization, Gson, etc.) in your project.

Scope

Like other generators here, one example does not define every union or optional field—use it as scaffolding, then refine with real API contracts.

JSON → Kotlin

?

Parses JSON in your browser and emits classes inferred from the sample shape. Nested objects become nested types; arrays use the first element only to guess item shape. Nothing is uploaded.

Rename types, use pointers or nullable types where needed, and align tags with your JSON encoder/decoder.

Common use cases

  • Draft data classes for kotlinx.serialization or Moshi from a real JSON sample.
  • Align mobile and backend field names before wiring adapters.
  • Share a quick Kotlin shape in reviews when the API payload is new.

Common mistakes to avoid

  • Assuming nullable types from a single non-null sample

    If a field can be absent or null in other responses, mark it nullable or default—samples lie by omission.

  • Mixing JVM and Kotlin keyword names without escaping

    Rename generated identifiers when they collide with reserved words or your style rules.

FAQ

Is Kotlin generated on your servers?

No. Generation runs locally in your tab.

Does this emit kotlinx.serialization annotations?

It focuses on data class scaffolding. Add framework-specific annotations and serializers in your project.

Related utilities you can open in another tab—mostly client-side.