java Json 到 kotlin 数据类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40391434/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 05:10:55  来源:igfitidea点击:

Json to kotlin data classes

javaandroidjsongsonkotlin

提问by Gorets

Is there existing service for generating kotlin data classes from json model in the way how it works on http://www.jsonschema2pojo.org/site? My new project has over complicated API responses, so it would save me time.

是否存在从 json 模型生成 kotlin 数据类的现有服务,其工作方式与http://www.jsonschema2pojo.org/站点上的工作方式相同?我的新项目有过于复杂的 API 响应,因此可以节省我的时间。

回答by u5167396

There is a plugin for Android Studio and Intellij Idea called JsonToKotlinClass.

有一个适用于 Android Studio 和 Intellij Idea 的插件,名为JsonToKotlinClass

You can convert jsoninto kotlin's data classwith it: https://github.com/wuseal/JsonToKotlinClass

你可以用它转换json成 kotlin 的data classhttps: //github.com/wuseal/JsonToKotlinClass

A AndroidStudio plugin for Converting json string into kotlin data class

用于将 json 字符串转换为 kotlin 数据类的 AndroidStudio 插件