JSON To Kotlin Class (JsonToKotlinClass)

Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio
Jun 30, 2018
39 486

Plugin for Kotlin to convert Json String into Kotlin data class code quickly

Features:

Generating Kotlin data class from any legal JSON string or any URLs that returns a JSON string as response
Generating Kotlin data class from any legal JSON text when right click on directory and select New -> Kotlin data class File from JSON

Supporting (almostly) all kinds of JSON libs' annotation(Gson, Jackson, Fastjson, MoShi and LoganSquare, kotlinx.serialization(default custom value))

Customizing your own annotations

Initializing properties with default values

Allowing properties to be nullable(?)

Determining property nullability automatically

Renaming property names to be camelCase style when selecting a target JSON lib annotation´╝Ä

Generating Kotlin data class as individual classes

Generating Kotlin data class as inner classes

Formatting any legal JSON string

Generating Map Type when json key is primitive type

Only create annotation when needed

Custom define data class parent class


kotlin Json Gson Fastjson Moshi LoganSquare Kotlinx

Full Usage Documentation

Download plugin

Recent change notes


Add support parent class declaration

Fixed bugs

General usage instructions

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!