Json to kotlin class plugin

Integrating JsonToKotlin Plugin With Android Studio

Android Studio is the best IDE for android development. Plenty of plugins are available and they can be installed easily via Android Studio itself. In computing, a plug-in is a software component that adds a particular characteristic to an existing computer program. When a program supports plug-ins, it enables customization. Plugins are a great way to increase productivity and overall programming experience.⁣⁣ Some tasks are boring and not fun to do, by using plugins in the android studio you can get more done in less time. One such plugin that we are going to see in this article is “JsonToKotlin Plugin“.

Note: You may refer to the 6 Most Useful Android Studio Plugins to know the most useful android studio plugins.

About JsonToKotlin Plugin

JSON to kotlin Class is a plugin to create Kotlin data class from JSON string, in other words, a plugin that changes JSON string to Kotlin data class. With this, you can generate a Kotlin data class from the JSON string programmatically. Supporting (almost) all kinds of JSON libs’ annotation(Gson, Jackson, Fastjson, MoShi and LoganSquare, kotlinx.serialization(default custom value)). Some of the important features are:

  • Customizing the own annotations
  • Initializing properties with default values
  • Allowing properties to be nullable(?)
  • Determining property nullability automatically
  • Renaming field names to be camelCase style when selecting a target JSON lib annotation.
  • Generating Kotlin class as individual classes
  • Generating Kotlin class as inner classes
  • Formatting any legal JSON string
  • Generating Map Type when JSON key is the 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
  • Normal Class support
  • Dynamic plugin load support
  • Support generating ListClass from JSONArray
  • Complex JSON schema supporting

JSON to kotlin Class is an excellent tool for Kotlin developers and it can convert a JSON string to Kotlin data class. The tool could not only understand the primitive types but also auto-create complex types. It’s simply accessible. We provide shortcut keymap ALT + K for Windows and Option + K for Mac, have a try and you are going to fall in love with it! JsonToKotlinClass just makes programming more delightful.

Installation of JsonToKotlin Plugin

Note: You may refer to How to Install and Uninstall Plugins in Android Studio? to Install and Uninstall Plugins in Android Studio.

Step 1: Go to the File > Settings > Plugins > Search for jsontokotlin as shown in the below image.

Читайте также:  Переменная равна другой переменной php

Step 2: Press the install button

Step 3: Once you got the plugin, please install it by clicking on the “Install” button. Then select the project location and right-click on that folder, select New > Kotlin data class file from JSON (as shown in the image below)

Step 4: Then in the place of JSON provision, provide the JSON that you want to convert. In our example, let us give the sample output of JSON that is meant for Exchange Rates as shown in the below image

Once it is given and generate, we can able to see 2 files got generated as shown in the below-attached image. Here two data class are generated.

ExchangeRates” is the data class nothing but the name that we specified If we check the JSON output and generated data class “ExchangeRates”, all the column names like

  • base -> String datatype,
  • date -> String datatype,
  • rates -> Rates datatype,
  • time_last_updated -> int datatype

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Intellij Idea, Android Studio plugin for generating Kotlin data classes from JSON. Helps to avoid writing boilerplate code for model classes. Supports annotations for Gson, Moshi, Jackson.

License

Mighty16/JSONToKotlinClass

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

Intellij Idea, Android Studio plugin.

Plugin generates Kotlin data classes from JSON text. It can find inner classes in nested JSON. You can disable undesirable fields in class, change field name, set it type to optional, specify default value and add annotations for popular json libraries.

• json highlight and validation
• nested json parsing
• var/val support
• default value support
• generation to single file
• annotations for Gson, Moshi, Jackson

Читайте также:  Форма входа

Right click on package -> Generate class from JSON -> Copy json, type class name -> Check field names and types -> Generate

Copyright (c) 2017 Mighty16

About

Intellij Idea, Android Studio plugin for generating Kotlin data classes from JSON. Helps to avoid writing boilerplate code for model classes. Supports annotations for Gson, Moshi, Jackson.

Источник

6 Most Useful Android Studio Plugins

Android Studio provides a platform where one can develop android apps for Android phones, tablets, Android Wear, Android TV. Android Studio is the official IDE for Android application development, and it is based on the IntelliJ IDEA. One can develop Android Applications using Kotlin or Java as the Backend Language and XML for developing frontend UI.

In computing, a plug-in is a software component that adds a particular characteristic to an existing computer program. When a program supports plug-ins, it enables customization. Plugins are a great way to increase productivity and overall programming experience.⁣⁣ Some tasks are boring and not fun to do, by using plugins in the android studio you can get more done in less time. ⁣⁣ So in this article, we will share with you 7 useful android studio plugins that will help to become a better android developer.⁣⁣

1. Key Promoter X

Key Promoter X helps to get the necessary shortcuts while working on android projects. When the developers utilize the mouse on a button inside the IDE, the Key Promoter X presents the keyboard shortcut that you should have used alternatively. Key Promoter X provides a simple way to study how to replace tiresome mouse work with keyboard keys and helps to transition to faster, mouse-free development. The Key Promoter X tool window gives a hit-list of the mouse actions that are utilized by the developers most and it quickly provides the shortcut that developers can use alternatively. Buttons having no shortcut, the Key Promoter X prompts with the opportunity to directly create one.

2. ButterKnifeZelezny

ButterKnifeZelezny is an android studio plug-in for creating ButterKnife injections from selected layout XML. It is a very simple plug-in for Android Studio/IDEA that supports one-click creation of Butterknife view injections. The fun fact is ButterKnifeProgrammers are lazy, and programmers who are not lazy are not good programmers. Almost Android developers should know @JakeWharton’s ButterKnife annotation library. The developer can implement this library without writing a lot of boring findViewById() and setOnClickListener(). The main purpose is to make it easy for developers to quickly generate the code of the control binding view and enhance coding efficiency.

3. Json To Kotlin Class

Json to kotlin Class is a plugin to create Kotlin data class from JSON string, in other words, a plugin that changes JSON string to Kotlin data class. With this, you can generate a Kotlin data class from the JSON string programmatically. Supporting (almost) all kinds of JSON libs’ annotation(Gson, Jackson, Fastjson, MoShi and LoganSquare, kotlinx.serialization(default custom value)). Some of the important features are:

  • Customizing the own annotations
  • Initializing properties with default values
  • Allowing properties to be nullable(?)
  • Determining property nullability automatically
  • Renaming field names to be camelCase style when selecting a target JSON lib annotation.
  • Generating Kotlin class as individual classes
  • Generating Kotlin class as inner classes
  • Formatting any legal JSON string
  • Generating Map Type when json key is the 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
  • Normal Class support
  • Dynamic plugin load support
  • Support generating ListClass from JSONArray
  • Complex json schema supporting
Читайте также:  Jd ru 411549 html

Json to kotlin Class is a an excellent tool for Kotlin developers and it can convert a JSON string to Kotlin data class. The tool could not only understand the primitive types but also auto-create complex types. It’s simply accessible. We provide shortcut keymap ALT + K for Windows and Option + K for Mac, have a try and you are going to fall in love with it! JsonToKotlinClass just makes programming more delightful.

4. Rainbow Brackets

Rainbow Brackets adds rainbow brackets and rainbows parentheses to the code. Color coding the brackets makes it simpler to obtain paired brackets so that the developers don’t get lost in a sea of identical brackets. This is a very helpful tool and saves the confusion of selecting which bracket needs to be closed. Each pair of brackets/parentheses has a different color. Pretty simple, but an excellent plugin.

5. CodeGlance

Codeglance plugin illustrates a zoomed-out overview or minimap similar to the one found in Sublime into the editor pane. The minimap enables fast scrolling letting you jump straight to sections of code. Some of the important features are:

  • Codeglance operates with both light and dark themes using the customized colors for syntax highlighting.
  • Worker thread for rendering
  • Color rendering using IntelliJ’s tokenizer
  • Scrollable!
  • Embedded into the editor window
  • Complete replacement for Code Outline that helps new Intellij builds.

6. ADB Idea

ADB Idea is a plugin for Android Studio and Intellij IDEA that speeds up the usual android development. It allows shortcuts for various emulator functionalities that are normally very time consuming, like resetting the app data, uninstalling the app, or initializing the debugger. The following commands are provided:

  • ADB Uninstall App
  • ADB Kill App
  • ADB Start App
  • ADB Restart App
  • ADB Clear App Data
  • ADB Clear App Data and Restart
  • ADB Start App With Debugger
  • ADB Restart App With Debugger
  • ADB Grant/Revoke Permissions
  • ADB Enable/Disable Wi-Fi
  • ADB Enable/Disable Mobile Data

Источник

Оцените статью