Create POJO Class for Kotlin

前端 未结 10 1912
闹比i
闹比i 2021-02-03 18:34

I want to create POJO class for Kotlin, as we know that www.jsonschema2pojo.org converts JSON to POJO so we can use it with gson.

Anyone know how to create Gson POJO for

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-03 19:19

    If I got your question, you might be searching some plugin for converting to POJO. So RoboPOJOGenerator may help you. You can use a plugin from File>Setting>Plugin>Browse Repositories and search for RoboPOJOGenerator. To use this plugin you first need to create a separate package like "data", right-click the package and you will see Generate POJO from JSON. Also, you need to include gson library in gradle because this plugin will automatically generate annotation of gson like @SerializedName, etc.

提交回复
热议问题