🚀 Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )
Kotlin
3,183
573 commits
updated Jun 3, 2025

Hi, Welcome! This is a plugin to generate Kotlin data class from JSON string, in another word, a plugin that converts JSON string to Kotlin data class (Json to Kotlin).
We also have a Java/Kotlin library. With this you can generate Kotlin data class from JSON string programmatically.
implementation 'com.sealwu.jsontokotlin:library:3.7.4'
This is a very cool tool for Kotlin developers, it can convert a JSON string to Kotlin data class. The tool could not only recognize the primitive types but also auto create complex types. It's easily accessible, we provide shortcut keymap ALT + K for Windows and Option + K for Mac, have a try and you'll fall in love with it! JsonToKotlinClass just makes programming more enjoyable, enjoy coding!





File --> Settings --> Plugins --> Browse Repositories --> Search JsonToKotlinClass
Restart your IDE
Press ALT + K for Windows or Option + K for Mac or right click on package -> New->Kotlin data clas file from JSON and continue as guided.
Have a try with the advanced dialog 😜
New -> Kotlin data class File from JSONdata class as individual classesdata class as inner classesExtensions moduleThis is the example JSON from json.org
{
"glossary":{
"title":"example glossary",
"GlossDiv":{
"title":"S",
"GlossList":{
"GlossEntry":{
"ID":"SGML",
"SortAs":"SGML",
"GlossTerm":"Standard Generalized Markup Language",
"Acronym":"SGML",
"Abbrev":"ISO 8879:1986",
"GlossDef":{
"para":"A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso":[
"GML",
"XML"
]
},
"GlossSee":"markup"
}
}
}
}
}
And with this plugin converting, Kotlin data classes would generate like this by default
data class Example(
val glossary: Glossary
)
data class Glossary(
val GlossDiv: GlossDiv,
val title: String
)
data class GlossDiv(
val GlossList: GlossList,
val title: String
)
data class GlossList(
val GlossEntry: GlossEntry
)
data class GlossEntry(
val Abbrev: String,
val Acronym: String,
val GlossDef: GlossDef,
val GlossSee: String,
val GlossTerm: String,
val ID: String,
val SortAs: String
)
data class GlossDef(
val GlossSeeAlso: List<String>,
val para: String
)
Want to try out the newest features?
$ git clone https://github.com/wuseal/JsonToKotlinClass
$ cd JsonToKotlinClass
$ ./gradlew buildPlugin
And you're done! Go to directory build/distributions and you'll find JsonToKotlinClass-x.x.zip, which can be installed via Install plugin from disk....
Find it useful and want to contribute? All sorts of contributions are welcome, including but not limited to:
Open an issue here if you find a bug;
Help test the EAP version and report bugs:
Go to the "Plugins" settings, click "Browse repositories..." => "Manage repositories..." and click the "+" button to add the EAP channel repository URL "https://plugins.jetbrains.com/plugins/eap/list". Optionally, you can also add the Alpha and Beta channel repository URLs "https://plugins.jetbrains.com/plugins/alpha/list" and "https://plugins.jetbrains.com/plugins/beta/list".
Kindly note that the "EAP" or "Alpha" or "Beta" channel update may be unstable and tend to be buggy, if you want to get back to the stable version, remove the "EAP" or "Alpha" or "Beta" version and reinstall this plugin from the "JetBrains Plugin Repository" channel, which can be filtered by the drop-down menu next to the search input field.
$ git clone https://github.com/wuseal/JsonToKotlinClass
$ cd JsonToKotlinClass
Open the build.gradle in IntelliJ, open "Gradle" tool window, expand the project view to "JsonToKotlinClass | Tasks | intellij | runIde", right-click and choose "Debug ...", and you're done! Create your PR here!
order by alphabetical feature for JsonToKotlinClassmake keyword property valid feature for JsonToKotlinClassThis project exists thanks to all the people who contribute.
The development of this plugin is powerly driven by JetBrains.
We analytics anonymous user behavior for improving plugin production, we've provided a switch case for that.
13,002 followers · starred Mar 2019
257 followers · starred Dec 2023
40 followers · starred Nov 2019
42 followers · starred Sep 2021
🚀 Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )
Kotlin
3,183
573 commits
updated Jun 3, 2025

Hi, Welcome! This is a plugin to generate Kotlin data class from JSON string, in another word, a plugin that converts JSON string to Kotlin data class (Json to Kotlin).
We also have a Java/Kotlin library. With this you can generate Kotlin data class from JSON string programmatically.
implementation 'com.sealwu.jsontokotlin:library:3.7.4'
This is a very cool tool for Kotlin developers, it can convert a JSON string to Kotlin data class. The tool could not only recognize the primitive types but also auto create complex types. It's easily accessible, we provide shortcut keymap ALT + K for Windows and Option + K for Mac, have a try and you'll fall in love with it! JsonToKotlinClass just makes programming more enjoyable, enjoy coding!





File --> Settings --> Plugins --> Browse Repositories --> Search JsonToKotlinClass
Restart your IDE
Press ALT + K for Windows or Option + K for Mac or right click on package -> New->Kotlin data clas file from JSON and continue as guided.
Have a try with the advanced dialog 😜
New -> Kotlin data class File from JSONdata class as individual classesdata class as inner classesExtensions moduleThis is the example JSON from json.org
{
"glossary":{
"title":"example glossary",
"GlossDiv":{
"title":"S",
"GlossList":{
"GlossEntry":{
"ID":"SGML",
"SortAs":"SGML",
"GlossTerm":"Standard Generalized Markup Language",
"Acronym":"SGML",
"Abbrev":"ISO 8879:1986",
"GlossDef":{
"para":"A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso":[
"GML",
"XML"
]
},
"GlossSee":"markup"
}
}
}
}
}
And with this plugin converting, Kotlin data classes would generate like this by default
data class Example(
val glossary: Glossary
)
data class Glossary(
val GlossDiv: GlossDiv,
val title: String
)
data class GlossDiv(
val GlossList: GlossList,
val title: String
)
data class GlossList(
val GlossEntry: GlossEntry
)
data class GlossEntry(
val Abbrev: String,
val Acronym: String,
val GlossDef: GlossDef,
val GlossSee: String,
val GlossTerm: String,
val ID: String,
val SortAs: String
)
data class GlossDef(
val GlossSeeAlso: List<String>,
val para: String
)
Want to try out the newest features?
$ git clone https://github.com/wuseal/JsonToKotlinClass
$ cd JsonToKotlinClass
$ ./gradlew buildPlugin
And you're done! Go to directory build/distributions and you'll find JsonToKotlinClass-x.x.zip, which can be installed via Install plugin from disk....
Find it useful and want to contribute? All sorts of contributions are welcome, including but not limited to:
Open an issue here if you find a bug;
Help test the EAP version and report bugs:
Go to the "Plugins" settings, click "Browse repositories..." => "Manage repositories..." and click the "+" button to add the EAP channel repository URL "https://plugins.jetbrains.com/plugins/eap/list". Optionally, you can also add the Alpha and Beta channel repository URLs "https://plugins.jetbrains.com/plugins/alpha/list" and "https://plugins.jetbrains.com/plugins/beta/list".
Kindly note that the "EAP" or "Alpha" or "Beta" channel update may be unstable and tend to be buggy, if you want to get back to the stable version, remove the "EAP" or "Alpha" or "Beta" version and reinstall this plugin from the "JetBrains Plugin Repository" channel, which can be filtered by the drop-down menu next to the search input field.
$ git clone https://github.com/wuseal/JsonToKotlinClass
$ cd JsonToKotlinClass
Open the build.gradle in IntelliJ, open "Gradle" tool window, expand the project view to "JsonToKotlinClass | Tasks | intellij | runIde", right-click and choose "Debug ...", and you're done! Create your PR here!
order by alphabetical feature for JsonToKotlinClassmake keyword property valid feature for JsonToKotlinClassThis project exists thanks to all the people who contribute.
The development of this plugin is powerly driven by JetBrains.
We analytics anonymous user behavior for improving plugin production, we've provided a switch case for that.
13,002 followers · starred Mar 2019
257 followers · starred Dec 2023
40 followers · starred Nov 2019
42 followers · starred Sep 2021