在我的JAVA项目中 每次运行后这行代码 System.out.println(securityResult);会输出{"code":"0","msg":"SUCCESS","data":{"appSecret":"9b","time":"20180316110301","timeSecret":"8bf54"}}我想知道怎么操作securityResult可以把data里面的数据转换成代码中的String appSecret = "9b";String time = "20180316110301"; String timeSrcret = "8bf54"
1 回答
UYOU
TA贡献1878条经验 获得超4个赞
使用net.sf.json包
JSONObject object=JSONObject.fromObject(securityResult); JSONArray array=JSONArray.fromObject(object.get("data")); object=array.getJSONObject(0); String appSecret=(String)object.get("appSecret"); String time=(String)object.get("time"); String timeSecret=(String)object.get("timeSecret");
添加回答
举报
0/150
提交
取消