2015-11-03 48 views

回答

0
String json = "..."; 

    try { 
     JSONObject jsonObj = new JSONObject(json); 
     JSONObject respObj = jsonObj.getJSONObject("response"); 
     JSONArray posts = respObj.getJSONArray("posts"); 
     JSONObject firstPost = (JSONObject) posts.get(0); 
     JSONArray photos = firstPost.getJSONArray("photos"); 
     JSONObject firstPhoto = (JSONObject) photos.get(0); 
     JSONObject photoSize = firstPhoto.getJSONObject("original_size"); 
     String url = photoSize.getString("url"); 
     Log.e("URL:", url); 
    } catch (JSONException e) { 
     e.printStackTrace(); 
    }