Hi I have a json string converted unsing the JSON framework into a dictionary and I need to extract its content. How could I iterate to the nested dictionaries? I have alrea
You probably have to try recursive function.
-(void)recurse:(NSDictionary *)dict counter: (int*) i parent:(NSString *) parent{
for (NSString* key in [dict allKeys]) {
id value = [dict objectForKey:key];
NSLog(@"%@ -> %@", parent, key);
if ([value isKindOfClass:[NSDictionary class]]) {
i++;
NSDictionary* newDict = (NSDictionary*)value;
[self recurse:newDict counter:i parent:key];
i--;
} else {
//Do smthg
}
}
}
this will list all keys and its level.