Jsionarray和jsionobject-----java

来源:互联网 发布:js将日期转换为时间戳 编辑:程序博客网 时间:2024/05/22 17:42

1、获取jsionobject中的每一个元素:

String   res={"location":{"latitude":39.77,"longitude":117.32}} JSONObject tmpJson1 = new JSONObject(res); JSONObject position = null; position = tmpJson1.getJSONObject("location"); Double wd = position.getDouble("latitude"); Double jd = position.getDouble("longitude");
1 0