All Projects → wuseal → Jsontokotlinclass

wuseal / Jsontokotlinclass

Licence: gpl-3.0
🚀 Plugin for Android Studio And IntelliJ Idea to generate Kotlin data class code from JSON text ( Json to Kotlin )

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Jsontokotlinclass

SerializedNameGen
Auto add or remove json annotation plugin, such as gson SerializedName, fastjson JSONField, jackson JsonProperty. It also support java and kotlin file.
Stars: ✭ 19 (-99.22%)
Mutual labels:  gson, jackson, fastjson
Easyjson
Provides an unified JSON access API, you can adapter any JSON library to Gson, Jackson, FastJson with easyjson。 提供了一个JSON门面库,就像slf4j一样。easyjson本身不做json的操作,完全依赖于底层实现库。可以直接使用Easyjson的API,底层的JSON库随时可切换。也可以使用其中某个json的API,然后通过easyjson适配给其他的json库
Stars: ✭ 54 (-97.79%)
Mutual labels:  jackson, gson, fastjson
android-studio-plugin
Integrate your Android project with Crowdin
Stars: ✭ 52 (-97.87%)
Mutual labels:  intellij-plugin, android-studio-plugin
Squaretest
Tracks issues for the Squaretest plugin for IntelliJ IDEA
Stars: ✭ 32 (-98.69%)
Mutual labels:  intellij-plugin, android-studio-plugin
SpockAdb
Spock Adb Plugin Helps you to have full control of your project
Stars: ✭ 102 (-95.82%)
Mutual labels:  intellij-plugin, android-studio-plugin
SideMirror
An Android Studio plugin to mirror your android devices with scrcpy directly from Android Studio.
Stars: ✭ 49 (-97.99%)
Mutual labels:  intellij-plugin, androidstudio-plugin
methanol
⚗️ Lightweight HTTP extensions for Java
Stars: ✭ 172 (-92.95%)
Mutual labels:  gson, jackson
niddler
No description or website provided.
Stars: ✭ 48 (-98.03%)
Mutual labels:  intellij-plugin, android-studio-plugin
spring-rest-2-ts
spring rest 2 ts is typescript generator which produces data model and services in typescript based on Spring MVC annotations. It supports generation for Angular and React
Stars: ✭ 59 (-97.58%)
Mutual labels:  gson, jackson
Immutables
Annotation processor to create immutable objects and builders. Feels like Guava's immutable collections but for regular value objects. JSON, Jackson, Gson, JAX-RS integrations included
Stars: ✭ 3,031 (+24.32%)
Mutual labels:  jackson, gson
json-serialization-benchmarking
Miscellaneous benchmarks for JSON serialization on JVM/Android
Stars: ✭ 48 (-98.03%)
Mutual labels:  gson, moshi
Javacodeaudit
Getting started with java code auditing 代码审计入门的小项目
Stars: ✭ 289 (-88.15%)
Mutual labels:  jackson, fastjson
moshi-gson-interop
An interop tool for safely mixing Moshi and Gson models in JSON serialization.
Stars: ✭ 39 (-98.4%)
Mutual labels:  gson, moshi
jackson-dynamic-filter
An easy way to determine filters dynamically using Jackson
Stars: ✭ 35 (-98.56%)
Mutual labels:  gson, jackson
Jsonschema2pojo
Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
Stars: ✭ 5,633 (+131.05%)
Mutual labels:  jackson, gson
Rxcache
A local reactive cache for Java and Android. Now, it supports heap memory、off-heap memory and disk cache.
Stars: ✭ 102 (-95.82%)
Mutual labels:  gson, fastjson
Idea Php Generics Plugin
Support generics types in PhpStorm via psalm / phpstan docblock
Stars: ✭ 146 (-94.01%)
Mutual labels:  intellij-plugin
Intellij Makefile
Makefile support for IntelliJ-based IDEs
Stars: ✭ 164 (-93.27%)
Mutual labels:  intellij-plugin
Foodium
It simply loads Posts data from API and stores it in persistence storage (i.e. SQLite Database). Posts will be always loaded from local database. Remote data (from API) and Local data is always synchronized.
Stars: ✭ 1,940 (-20.43%)
Mutual labels:  moshi
Androidstarter
A sample Android app using the MVP architecture.
Stars: ✭ 140 (-94.26%)
Mutual labels:  jackson

JsonToKotlinClass

Build Status GitHub release GitHub stars JetBrains Plugin Download GitHub closed issues license

Kotlin IntelliJ Idea Plugin Android Studio Plugin

JsonToKotlinClass

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 'wu.seal.jsontokotlin:library:3.6.1'

Overview

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

Easy Use

alt text

Want to generate classes code in inner class model? Do like this.

alt text

Want to generate Kotlin data class file? Do like this.

alt text

Want to generate Kotlin data classes in single file? Do like this.

alt text

Usage

  • Search 'JsonToKotlinClass' in Intellij Idea Plugin Repository Or AndroidStudio Plugin Repository And Install it.

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.

Advanced usage

Have a try with the advanced dialog 😜

Features

Generate Example

This 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
)

Change Log

Build From Source

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....

Contribute to This Repo

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.

  • Contribute your code:
$ 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!

Chinese Detail Document (中文文档)

Others

  • Any kind of issues are welcome.
  • Pull Requests are highly appreciated.

Thanks

  • Thank @davidbilik for giving me the first awesome advice.
  • Thank @cgoodroe for opening many awesome issues for me, help me improve myself
  • Thank @wangzhenguang for reminding me of the details of the problem
  • Thank @kezhenxu94 for introducing CI/CD to save me a lot of time :)
  • Thank iqbalhood for contributing logo for this project
  • Thank akindone for adding order by alphabetical feature for JsonToKotlinClass
  • Thank rafalbednarczuk for adding make keyword property valid feature for JsonToKotlinClass

Find it useful ? ❤️

  • Support and encourage me by clicking the button on the upper right of this page. ✌️
  • Share to others to help more people have a better develope expierience ❤️

Authors

This project exists thanks to all the people who contribute.

Acknowledgement

The development of this plugin is powerly driven by JetBrains.

Join the Community

Let's talk
Join JsonToKotlinClass Slack
Join JsonToKotlinClass Telegram

Note:

We analytics anonymous user behavior for improving plugin production, we've provided a switch case for that.

Stargazers over time

Stargazers over time

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].