我会保持简短。我想从“令牌”获取字符串值。但是从我所看到的,我的json对象中有一个“数据”数组。如何从此数组中检索数组,特别是令牌字符串?
{
"response":true,
"state":8,"data":{
"token":"$2a$08$oeH79FjMV6ZQTO.9qqfToujNBbst420Xx7o9jJdFgbJsJijtEpX\/O",
"numbers":[{
"number":"4581102282",
"enabled":"0",
"custid":"1528511113",
"route":"rock",
"clir":"2",
"mob":"1",
"clip":"",
"mbx":"0",
"trunk":"2",
"valid_from":"2011-09-07",
"valid_to":"2011-10-05"
}]
}
}
答案 0 :(得分:0)
只需使用
JSONObject jsonObj=new JSONObject(response);
JSONObject jsonData=jsonObj.getJSONObject("data");
String token=jsonData.getString("token");