Jsionarray和jsionobject-----java

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");

你可能感兴趣的:(jsion)