data class Topic( @SerializedName("id") val id: Long, @SerializedName("name") val name: String, @SerializedName("image") val image: String, @SerializedName("description") val description: String)
到JSON:
val gson = Gson()val json = gson.toJson(topic)
从JSON:
val json = getJson()val topic = gson.fromJson(json, Topic::class.java)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)