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.

Overview

JSONToKotlinClass

Intellij Idea, Android Studio plugin.

Android Arsenal

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.

Features:

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

Download

You can install it from plugin repository

How to use

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

License

MIT License

Copyright (c) 2017 Mighty16

Comments
  • Support minimal Moshi json bindings

    Support minimal Moshi json bindings

    Differences

    1. keeps camel case json names
    2. needs some special case names e.g. .tag
    3. Doesn't default required vals like strings to "". Perhaps making more things nullable by default would help, as a single non-null result isn't proof it works.
    // SharedLinkResponse
    data class RevokeFailureReason(@Json(name=".tag") val tag: String)
    data class TeamMemberInfo(val member_id: String, val team_info: TeamInfo, val display_name: String)
    data class ResolvedVisibility(@Json(name=".tag") val tag: String)
    data class TeamInfo(val name: String, val id: String)
    data class LinkPermissions(val can_revoke: Boolean, val resolved_visibility: ResolvedVisibility, val revoke_failure_reason: RevokeFailureReason?)
    data class SharedLinkResponse(val rev: String, val team_member_info: TeamMemberInfo?, val size: Int, val server_modified: String,
                                  val path_lower: String, val name: String, val link_permissions: LinkPermissions,
                                  @Json(name=".tag") val tag: String, val id: String, val client_modified: String, val url: String)
    
    opened by yschimke 7
  • I don't see the option to generate the classes

    I don't see the option to generate the classes

    Linux, Android studio 3.0.1, JSONToKotlinClass 1.5.1

    I don't see the option to generate the classes when I rightclick on a package.

    However, it available on Alt+K inside a file.

    opened by joshdaquino 1
  • react-native 空指针报错

    react-native 空指针报错

    Attempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable()' on a null object reference

    opened by bojianyin 0
  • Numbers in JSON Are Removed In Target Name

    Numbers in JSON Are Removed In Target Name

    If you have a json with numbers in keys like this: "url16": "https://...", "url48": "https://..."

    JSONToKotlinClass removed these numbers and the resulted class looked like this: data class Icon(val url: String = "", val url: String = "",

    This obviously results in a compiler error and you have to add the missing numbers manually.

    opened by Grauen 0
  • how to disable set default value ?

    how to disable set default value ?

    Hi, is there any way to disable set every field with default value(such as val someInt=0, val strField=""), maybe without it will be neater.

    opened by devzyc 0
  • Imported JSONtoKotlinClass.jar. But when I try to generate data class it is throwing ClassNotFound exception.

    Imported JSONtoKotlinClass.jar. But when I try to generate data class it is throwing ClassNotFound exception.

    y: java.lang.ClassNotFoundException: org.json.JSONException PluginClassLoader[com.mighty16.json.kotlin.class, 0.9.6] com.intellij.ide.plugins.cl.PluginClassLoader@16da654d at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:115)

    opened by manishktx 0
A Model-View-Presenter / Model-View-Intent library for modern Android apps

Mosby A Model-View-Presenter and Model-View-Intent library for Android apps. Dependency dependencies { compile 'com.hannesdorfmann.mosby3:mvi:3.1.1

Hannes Dorfmann 5.5k Dec 25, 2022
A data-binding Presentation Model(MVVM) framework for the Android platform.

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED. As personal time contraints, I am currently unable to keep up. Please use official android da

RoboBinding open source 1.3k Dec 9, 2022
The most complete and powerful data-binding library and persistence infra for Kotlin 1.3, Android & Splitties Views DSL, JavaFX & TornadoFX, JSON, JDBC & SQLite, SharedPreferences.

Lychee (ex. reactive-properties) Lychee is a library to rule all the data. ToC Approach to declaring data Properties Other data-binding libraries Prop

Mike 112 Dec 9, 2022
Android part of the Android Studio(IntellijIDEA) OkHttp Profiler plugin

OkHttpProfiler Android Library Created by LocaleBro.com - Android Localization Platform The OkHttp Profiler plugin can show requests from the OkHttp l

Ievgenii 261 Dec 8, 2022
Nucleus is an Android library, which utilizes the Model-View-Presenter pattern to properly connect background tasks with visual parts of an application.

Nucleus Deprecation notice Nucleus is not under develpment anymore. It turns out that Redux architecture scales way better than MVP/MVI/MVVM/MVxxx and

Konstantin Mikheev 2k Nov 18, 2022
droidparts 6.7 0.0 L5 Java DI, ORM, JSON, ...

DroidParts a carefully crafted Android framework that includes: DI - injection of Views, Fragments, Services, etc. ORM - efficient persistence utilizi

DroidParts 779 Dec 21, 2022
Add new features for reverse engineering, such as: renaming of classes, fields, methods, variables, reference graphs and more.

Super JADX features Add new features for reverse engineering, such as: renaming of classes, fields, methods, variables, reference graphs and more. bas

null 284 Dec 28, 2022
Small Warp Plugin developed in Kotlin

Warps A small warps plugin for the 1.17 SMP. Minecraft 1.17 Spigot Contributing Install Java 16 Fork this repo Clone your fork Make your changes Use h

MenuDocs 6 Feb 19, 2022
Pet project using Clean Architecture + MVVM + Reactive Extensions + Android Architecture Components. The data are fetched from LondonTheatreDirect API. 🎭

Theatre Pet project using Clean Architecture + MVVM + Reactive Extensions + Android Architecture Components. The data is fetched from LondonTheatreDir

André Mion 646 Jan 9, 2023
A plugin system that runs like a browser, but instead of load web pages, it load apk plugins which runs natively on Android system.

Android Dynamic Loader Android Dynamic Loader is a plugin system. The host application is like a browser, but instead of load web pages, it load plugi

Tu Yimin 1.4k Dec 28, 2022
Android Plugin Framework

Android Plugin Framework This project is pre-mature and may be changed very frequently. Introduction Android Plugin Framework (APF) aims to providing

Umeng Limited 322 Nov 17, 2022
Gradle plugin to deploy Android Snapshot Versions

Android Snapshot Publisher is a Gradle plugin to prepare and distribute Android Snapshot versions to multiple distribution sources in a simple and com

xmartlabs 144 Nov 29, 2022
LiteOrm is a fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line of code efficiently.

#LiteOrm:Android高性能数据库框架 A fast, small, powerful ORM framework for Android. LiteOrm makes you do CRUD operarions on SQLite database with a sigle line

马天宇 1.5k Nov 19, 2022
Create kotlin android project with one line of command.

README This is an android application template project built with kotlin language and some useful libraries. It provides a creator script to quickly c

nekocode 1.6k Dec 20, 2022
kotlin-core - A full framework for making Android apps. Based on Anko and Kotson.

kotlin-core This package is not Android-specific, and can be used across platforms. However, for a good example of use in Android, take a look at kotl

Lightning Kite 36 Oct 3, 2022
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Codename One 1.4k Dec 23, 2022
Create kotlin android project with one line of command.

README This is an android application template project built with kotlin language and some useful libraries. It provides a creator script to quickly c

nekocode 1.6k Dec 20, 2022
A collection of hand-crafted extensions for your Kotlin projects.

Splitties Splitties is a collection of small Kotlin multiplatform libraries (with Android as first target). These libraries are intended to reduce the

Louis CAD 2.2k Dec 25, 2022
A modern framework for full stack web apps in Kotlin

Kobweb is an opinionated Kotlin framework for creating websites and web apps, built on top of Web Compose and inspired by Next.js and Chakra UI.

Varabyte 425 Jan 8, 2023