使用回调响应中的数据来获取键值对

时间:2019-08-01 13:15:25

标签: android kotlin

我收到来自API的响应,原因是 {"meta":{...},"links":{...},"data":[{...."name":"ABC",.....}]}}}

```
        useCaseFactory.userDomainModel.GetUser(userId, withDataArray, null, object : Callback {
                override fun onFailure(call: Call, e: IOException) {
                    println("ERROR: " + e.message)
                }
                @Throws(IOException::class)
                override fun onResponse(call: Call, response: Response) {
                    val responseBody = response.body()
                    println(responseBody.string())
                }
            })


```

response.body.string()给出{“元”:{...},“链接”:{...},“数据”:[{....“名称”:“ ABC”, .....}]}}}

必填名称:ABC

0 个答案:

没有答案