JSON To Kotlin


Source link: https://github.com/wuseal/JsonToKotlinClass

JsonToKotlinClass

Hi,Welcome to come to see me! I am a plugin for Kotlin generate Kotlin data class code from a JSON string also as say a plugin for Kotlin to convert JSON String into Kotlin data class code (Json to Kotlin)

Overview

Hi,This is a very cool tool for Kotlin developers ,It can convert the Json String into Kotlin Data Class code ,and paste it into your editor file ,The tool could recognize the Primitive Type of Json String and make Type Identifier respectively ,It taste easily ,Just have test,guys! Just press short key ALT + K ,And then,start your Kotlin program travel ! JsonToKotlinClass make program more happy!

Functions

  • Generate Kotlin data class from any legal JSON text.
  • Support JSON Serialize Lib Annotation(Gson,Jackson,Fastjson,MoShi and LoganSquare)
  • Support customize your own Annotation

How to use

  • Search 'JsonToKotlinClass' in Intellij Idea Plugin Repositroy Or AndroidStudio Plugin Repository And Install it.
    File --> Settings --> Plugins --> Browse Repositories -->Search JsonToKotlinClass
  • Restart your Develop tools
  • Press short key ALT + K And Then you will know how to use

Demos

Default :

Configure with Gson support on and init with deault value on and comment off

Config with custome your own annotations support on and init with deault value on

Generate Example

  • Example with none json lib support and comment option on

     data class FD(
    
     val programmers: List<Programmer>,
    
     val authors: List<Author>,
    
     val musicians: List<Musician>
      )
    
     data class Musician(
    
     val firstName: String, //Eric
    
     val lastName: String, //Clapton
    
     val instrument: String //guitar
      )
    
     data class Author(
    
     val firstName: String, //Isaac
    
     val lastName: String, //Asimov
    
     val genre: String //science fiction
      )
    
     data class Programmer(
    
     val firstName: String, //Brett
    
     val lastName: String, //McLaughlin
    
     val email: String //aaaa
      ) 
  • Example with gson option on and init with default value option on

    data class TestData(
    
    @SerializedName("ticketInfo") val ticketInfo: TicketInfo = TicketInfo(),
    
    @SerializedName("trainInfo") val trainInfo: TrainInfo = TrainInfo(),
    
    @SerializedName("trainScheduleHead") val trainScheduleHead: List<String> = listOf(),
    
    @SerializedName("extInfo") val extInfo: ExtInfo = ExtInfo(),
    
    @SerializedName("trainScheduleBody") val trainScheduleBody: List<TrainScheduleBody> = listOf()
     )
    
      data class TrainScheduleBody(
    
    @SerializedName("mxl") val mxl: Long = 0, //12490639969101
    
    @SerializedName("content") val content: List<Int> = listOf()
     )
    
      data class TrainInfo(
    
    @SerializedName("T110") val t110: T110 = T110()
     )
    

Chinese Detail Document (????)

Others

  • Welcome anyone to raise new issue.
  • Welcome anyone to push a pull request to improve me.

Thanks

  • Thank @davidbilik give me first awesome advice.
  • Thank @cgoodroe raise many awesome issues for me,Help me improve myself
  • Thank @wangzhenguang remains me the details of problem

Find me useful ? ❤?

  • Support me by clicking the ⭐? button on the upper right of this page. ✌?
  • Spread to others to let more people have a better develope expierience ❤?

Resources

Android Library to create Floating Action Button Animations.

Insanely easy way to define clickable links within a TextView.

This project shows how to visualize a tree structure using RecyclerView.

Library for securing your SharedPreferences information.

Android dex file extractor,anti-bangcle.

Sharedsqlite is a simple thread-safe database with a single table with a key-value schema where you can save your primitive data types that suites nowhere else excluding the headache of messing around with committing and reading from the SharedPreferences.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes