iOS JSON解析,包含多个数组的数组

我有一个带有多个对象的
JSON数组,我不知道如何将“url”标记作为NSArray或NSDictionary来获取并在Tableview中显示该图像URL.我无法更改JSON数据格式.我该怎么做?

以下是JSON响应的样子:

{
"meta": {
    "total_count": 10
},
"pages": [
    {
        "id": 7,
        "meta": {
            "type": "dashboard.NewsEvents",
            "detail_url": "http://suno.to/api/v1/pages/7/"
        },
        "title": "NoEvent",
        "created_at": "2016-03-06T10:42:19.646000Z",
        "cover_url": [
            [
                {
                    "url": "/media/images/Maha_Shivratri2.original.jpg",
                    "title": "Maha Shivratri2.jpg"
                },
                {
                    "url": "/media/images/Maha_Shivratri1.original.jpg",
                    "title": "Maha Shivratri1.jpg"
                }
            ],
            [
                {
                    "url": "/media/images/Celebrations.original.jpg",
                    "title": "Celebrations.jpg"
                },
                {
                    "url": "/media/images/Crew.original.jpg",
                    "title": "Crew.jpg"
                },
                {
                    "url": "/media/images/World_record.original.jpg",
                    "title": "World record.jpg"
                },
                {
                    "url": "/media/images/AI_pilots.original.jpg",
                    "title": "AI pilots.jpg"
                }
            ],
            [
                {
                    "url": "/media/images/CbVv-VbWEAAmwv_.original.jpg",
                    "title": "DAL SWARAJ YATRA"
                },
                {
                    "url": "/media/images/CbVv_-TWwAE7RjM.original.jpg",
                    "title": "DAL SWARAJ YATRA"
                },
                {
                    "url": "/media/images/CbVv_SmXIAALQP8.original.jpg",
                    "title": "DAL SWARAJ YATRA"
                },
                {
                    "url": "/media/images/CahEc--UkAArc_z.original.jpg",
                    "title": "DAL SWARAJ YATRA"
                }
            ]
        ]
    },
    {
        "id": 2530,
        "meta": {
            "type": "dashboard.NewsEvents",
            "detail_url": "http://suno.to/api/v1/pages/2530/"
        },
        "title": "World Culture Festival",
        "created_at": "2016-03-12T06:59:21.023000Z",
        "cover_url": [
            [
                {
                    "url": "/media/images/Security.original.jpg",
                    "title": "Security check"
                }
            ],
            [
                {
                    "url": "/media/images/Elephant_statues.original.jpg",
                    "title": "Elephant"
                }
            ],
            [
                {
                    "url": "/media/images/6.original.jpg",
                    "title": "Stage"
                },
                {
                    "url": "/media/images/4.original.jpg",
                    "title": "Stage"
                }
            ]
        ]
    },
    {
        "id": 2675,
        "meta": {
            "type": "dashboard.NewsEvents",
            "detail_url": "http://suno.to/api/v1/pages/2675/"
        },
        "title": "Holi in Barsana",
        "created_at": "2016-03-17T12:35:09.308000Z",
        "cover_url": [
            [
                {
                    "url": "/media/images/Brajwasi_playing_holi_.original.jpg",
                    "title": "Holi in Barsana"
                },
                {
                    "url": "/media/images/dancing_.original.jpg",
                    "title": "Holi in Barsana"
                },
                {
                    "url": "/media/images/holi.._.original.jpg",
                    "title": "Holi in Barsana"
                },
                {
                    "url": "/media/images/holi..._.original.jpg",
                    "title": "Holi in Barsana"
                }
            ],
            [
                {
                    "url": "/media/images/Lathmar_holi_19_n54f7LJ.original.jpg",
                    "title": "Lathmar Holi in Barsana"
                }
            ],
            [
                {
                    "url": "/media/images/Lathmar_holi_17.original.jpg",
                    "title": "Lathmar Holi in Barsana"
                },
                {
                    "url": "/media/images/Lathmar_holi_20.original.jpg",
                    "title": "Lathmar Holi in Barsana"
                }
            ]
        ]
    },

我正在使用此代码来获取“url”数组. Plz纠正我?

 NSArray *imageUrlArray = [[self.jsonData    objectAtIndex:indexPath.row]objectForKey:@"cover_url"];
  NSLog(@"IMAGE URL ARRAY:%@",imageUrlArray);


  NSString *imageUrl = [imageUrlArray valueForKey:@"url"];
  NSLog(@"IMAGE URL:%@",imageUrl);

最佳答案 查看JSON结构 –
http://jsonviewer.stack.hu/

NSMutableArray* imageurlArray = [NSMutableArray new];
NSArray* jsonArray = jsonData[@"pages"];

for (int i = 0; i<[jsonArray count]; i++) {
    NSArray* coverUrlArray = jsonArray[i][@"cover_url"];
    for (int t = 0; t< [coverUrlArray count]; t++) {
        NSArray* UrlArray = coverUrlArray[t];
        for (int x = 0; x<[UrlArray count]; x++) {
            [imageurlArray addObject:UrlArray[x][@"url"]];
        }
    }
}
NSLog(@"imageurlArray: %@", imageurlArray);

//imageurlArray contains all url
//In cell for row at indexpath --> use imageurlArray[indexPath.row];
点赞