I think the format for json is wrong. It should be something like:-
"posts":[{"id":917,"tags":39},{"id":918,"tags":38}]
This is an array of one 2 dictionary objects. Then, you can get the objects using
NSArray * postArray = [json objectForKey:@"posts"];
NSDictionary * firstObject = [postArray firstObject];
NSNumber * id1 = [firstObject objectForKey:@"id"];
NSArray * tags1 = [firstObject objectForKey:@"tags"];
NSNumber* tag1 = [[tags firstObject] objectForKey:@"id"];
Try this out.
Updated answer:
NSArray * postArray = [json objectForKey:@"posts"];
for(int i=0;i<postArray.count;i++){
NSDictionary * postObject = [postArray objectAtIndex:i];
NSNumber * postId = [postObject objectForKey:@"id"];
NSLog(@"PostID:%@",postId);
NSArray * postTag = [postObject objectForKey:@"tags"];
for(int j=0;j<postTag.count;j++){
NSDictionary * postTagIdDic = [postTag objectAtIndex:j];
NSNumber * postTagId = [postTagIdDic objectForKey:@"id"];
NSLog(@"postTagId:%@",postTagId);
}
}