String find1 = Bmob.findByName("wtsr", where1.toString());//数据返回的结果
//System.out.println("this:"+find1);
JSONObject fromObject = JSONObject.fromObject(find1);//转化为json对象
System.out.println(fromObject);
输出结果{"results":[{"coorange":"0.37326197519106297,0.46580270797368295","createdAt":"2017-08-09 09:09:54","id":1,"name":"wth","number":"390099009","objectId":"B8XoAAAK","updatedAt":"2017-08-15 17:36:37"}]}
JSONArray jsonArray = fromObject.getJSONArray("results");//获取json对象中的数组
//System.out.println(jsonArray);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = (JSONObject) jsonArray.get(i);
objectId =(String)jsonObject.get("objectId");
}
另一个复杂的json数据
{ "resultcode":"200",
"reason":"查询成功!",
"result":
{"data":
[
{"MCC":"0","MNC":"0","LAC":"10342","CELL":"3873","LNG":"113.908476","LAT":"22.577146","O_LNG":"113.91334418403","O_LAT":"22.574103190104","PRECISION":"653","ADDRESS":"广东省深圳市宝安区新安三路"}
]
},
"error_code":0
}