First Element of Dictionary

Published on Wednesday, 1 October 2014

Get the first Element of a Dictionary:

[gist https://gist.github.com/80552a75bfdf071f58cb /]

URL: http://gdata.youtube.com/feeds/api/users/unpluggedacoustic1/uploads/?alt=json

JSON:

"media$group":{
  "media$thumbnail": [
    { "url":"http://i.ytimg.com/vi/OKJk4QVyUTw/0.jpg","height":360,"width":480,"time":"00:01:39.500" },
    { "url":"http://i.ytimg.com/vi/OKJk4QVyUTw/1.jpg","height":90,"width":120,"time":"00:00:49.750" },
    { "url":"http://i.ytimg.com/vi/OKJk4QVyUTw/2.jpg","height":90,"width":120,"time":"00:01:39.500" },
    { "url":"http://i.ytimg.com/vi/OKJk4QVyUTw/3.jpg","height":90,"width":120,"time":"00:02:29.250" }
  ]
}
NSDictionary *mediagroup = [entry objectForKey:@"media$group"];
//NSLog(@"MediaGroup: %@", mediagroup);
NSDictionary *mediathumbnail = [mediagroup objectForKey:@"media$thumbnail"][0];
NSString *url = [mediathumbnail objectForKey:@"url"];
NSLog(@"%@", url);

Wordpress Original Link