如何在 kotlin 中分离 json 数据
How to segregate json data in kotlin
我收到了 json 格式的回复。我只需要传递价值。如何隔离消息值。你能帮帮我吗
{status:"1", message:"cu34343"}
if response as object
val jsonObject = JSONTokener(response).nextValue() as JSONObject
val message = jsonObject.getString("message")// Before That check null or
not
Log.i("message: ", message)
还参考了使用 gson 和响应模型 class 转换器的不同响应。
我收到了 json 格式的回复。我只需要传递价值。如何隔离消息值。你能帮帮我吗
{status:"1", message:"cu34343"}
if response as object
val jsonObject = JSONTokener(response).nextValue() as JSONObject
val message = jsonObject.getString("message")// Before That check null or
not
Log.i("message: ", message)
还参考了使用 gson 和响应模型 class 转换器的不同响应。