JSON to Kotlin Data Class Generator
Generate Kotlin data classes from JSON, ready for kotlinx.serialization, Jackson or Klaxon. Nested objects become their own classes and optional fields are nullable.
How it works
- 1
Paste or open your data
Paste text, drop a file onto the editor or click Open file. Load sample shows how the tool works.
- 2
Adjust the options
The result updates as you type. Change the options to get exactly the output you need.
- 3
Copy or download
Copy the result to the clipboard or download it as a file.
Why PixNudge
Nothing is uploaded
Your data is processed in your browser and never sent to a server, so API keys, tokens and customer data stay private.
Instant, even for large files
There is no round trip to a server: results appear as you type, and files of several megabytes are handled smoothly.
Exact numbers
Long numbers such as 64-bit IDs are kept exactly as written instead of being rounded.
Frequently asked questions
Which JSON libraries are supported?
With Types only on, you get plain data classes. Turn it off and choose kotlinx.serialization, Jackson or Klaxon to add the annotations and helper code for that library.
How are optional fields typed?
Keys that are missing from some items or can be null become nullable types with a default of null, such as val coupon: String? = null.
Can I set the package name?
Yes. Enter it under Package and it is written at the top of the file.