Kotlin解析json数据
作者:互联网
背景
kotlin,解析okhttp返回得数据
方法
class ResCode (public val obj:JsonObject){
var status:Int ?=-1
var msg:String ?=""
}
fun parseJsonWithJsonObject(response:Response){
result= response.body?.string().toString()
var resCode=Gson().fromJson(result,ResCode::class.java)
println(resCode.status)
println(resCode.msg)
}
标签:resCode,ResCode,Kotlin,println,json,result,var,解析,response 来源: https://blog.csdn.net/sdau_clt/article/details/121100412