JSON To Kotlin Class (JsonToKotlinClass)

Compatible with: IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion GoLand DataGrip Rider MPS Android Studio
Jan 18, 2019
75 523

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

Fast use it with short cut key ALT + K on Windows or Option + K on Mac

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

Sort property order by Alphabetical

Make keyword property valid

Support Loading JSON From Paster/Local File/Http URL

Support customize your own plugin by Extension Module


demo

kotlin Json Gson Fastjson Moshi LoganSquare Kotlinx

Full Usage Documentation

Download plugin

Recent change notes


Add Support Loading JSON From Paster/Local File/Http URL

Add Extension Module for easy extension

Fix 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!