請問我想從JSON數組thumbnail_images中獲取URL,它位於另一個medium_large數組內,我如何從第二個數組獲取數據。我已經能夠使用此代碼從這個JSON如何從內部json數組中獲取數據android
"attachments": [
{
"id": 367,
"url": "http://street2view.com/wp-content/uploads/2017/01/mmm.png",
得到的網址:
JSONArray attachments = post.getJSONArray("attachments");
if (null != attachments && attachments.length() > 0) {
JSONObject attachment = attachments.getJSONObject(0);
if (attachment != null)
item.setAttachmentUrl(attachment.getString("url"));
}
所以我怎麼能夠從內部陣列獲取數據,如在此代碼,我怎麼能得到URL
"thumbnail_images": {
"medium_large": {
"url": "http://street2view.com/wp-content/uploads/2017/01/mmm.png",
"width": 749,
"height": 400
請確保接受@ classicalConditioning的答案,如果它有幫助。 –
請不要用答案說謝謝 –