funmain() = runBlocking { val moshi = Moshi.Builder() .addLast(KotlinJsonAdapterFactory()) .build()
val json = """{"_name":"xxx","age":12}""" val person = moshi.adapter(Peoson::class.java).fromJson(json) println(person) } @JsonClass(generateAdapter = true) //为了贴合condegen使用,他可以提高moshi在kotlin中的运行时速率 dataclassPeoson( @Json(name = "_name") val name:String, val age:Int )