JSON to Java Converter
Convert JSON to Java POJO classes for Java development
JSON Input
Java Output
What Is JSON to Kotlin?
Kotlin uses data classes with @SerializedName or @JsonProperty for JSON. This tool generates Kotlin data classes from your JSON. Use with Jackson or Gson. Conversion runs in your browser. Nothing is sent to a server.
The JSON specification defines objects and arrays. Kotlin's kotlinx.serialization is an alternative to Jackson. For REST APIs, paste the response from Postman or your app, then generate the data classes.
How to Use This Tool
Paste or Upload JSON
Paste your JSON into the left editor or upload a file. Use the config panel to set the root Class Name, Package, Use Lombok, and Nullable Types. The more representative your sample, the better the generated data classes.
Review the Generated Classes
The right panel shows Kotlin data classes. Nested objects become nested classes or separate data classes. Use ObjectMapper().readValue<YourType>(json) (Jackson) or Gson().fromJson(json, YourType::class.java) to parse. Add @SerializedName if JSON keys differ from property names.
Copy or Download
Use Copy or Download. For formatting JSON first, use the JSON Formatter. For validation, use the JSON Validator.
JSON to Kotlin Examples
Here is an example of generating Kotlin data classes from a JSON object.
Example: Subscriber record
JSON input:
Generated Kotlin output:
When JSON to Kotlin Helps
Android REST clients, Ktor backends, and Spring Boot Kotlin apps all consume JSON. Pasting API responses from Postman or your app here gives you typed data classes quickly. Manually writing data classes for complex nested JSON is tedious; this tool infers the structure from your sample. For pulling out specific values first, use the JSON Path tool.
Flutter and Dart projects that share APIs with Kotlin/Android can use the JSON to Dart tool for the same payload. For schema-based validation, use the JSON Schema Generator.
Frequently Asked Questions
Data class vs regular class?
Kotlin data classes give you equals, hashCode, toString, and copy for free. Ideal for DTOs and API models. See Kotlin data classes.
Jackson vs Gson vs kotlinx.serialization?
Jackson and Gson work with the generated classes. Jackson uses @JsonProperty; Gson uses @SerializedName. kotlinx.serialization uses @SerialName. The generator typically produces Jackson-compatible output.
Is my data private?
Yes. Generation runs entirely in your browser. No JSON or code is sent to any server.
What about nullable types?
Enable Nullable Types for optional JSON fields. Kotlin's Type? distinguishes between present and absent. Without it, you may get default values for missing fields.
Can I use this with Android?
Yes. The generated data classes work with Retrofit, OkHttp, or any Android networking library that returns JSON. Add the appropriate annotations for your serialization library.
Related Tools
For Kotlin, see Kotlin serialization and data classes. For Jackson, see Jackson Kotlin module. For JSON, see json.org and RFC 8259. For MDN JSON.