【发布时间】:2017-01-22 21:51:30
【问题描述】:
请我尝试从 JSON 数组 thumbnail_images 中获取 URL,它位于另一个 medium_large 数组中,我如何从第二个数组中获取数据。我已经能够从这个 JSON 中获取 URL
"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
【问题讨论】: