Well, if Type
will everytime returns your the key
, you can do this:
NSString *yourKey = [yourDictionary objectForKey:@"Type"];
NSDictionary *countDict = [yourDictionary objectForKey:yourKey];
int bird = [[countDict objectForKey:@"bird"] intValue];
int animal = [[countDict objectForKey:@"animal"] intValue];
Other solution:
for (NSString *aKey in yourDictionary)
{
if ([[yourDictionary objectForKey:@"aKey"] isKindOfClass:[NSDictionary class]])
{
NSDictionary *countDict = [yourDictionary objectForKey:aKey];
int bird = [[countDict objectForKey:@"bird"] intValue];
int animal = [[countDict objectForKey:@"animal"] intValue];
}
}
Other solution, according if your object may contain other sub-dictionary:
for (NSString *aKey in yourDictionary)
{
if ([[yourDictionary objectForKey:@"aKey"] objectForKey:@"Count"])
{
NSDictionary *countDict = [[yourDictionary objectForKey:@"aKey"] objectForKey:@"Count"];
int bird = [[countDict objectForKey:@"bird"] intValue];
int animal = [[countDict objectForKey:@"animal"] intValue];
}
}