
Untitled
By: a guest on
May 4th, 2012 | syntax:
None | size: 1.42 KB | hits: 10 | expires: Never
Accessing values of unknown Dictionary Keys
{
"themes": [
[
"Direction des Routes Secteur de Pithiviers ",
"mairies",
"Morailles 45300 PITHIVIERS LE VIEIL ",
"0238345744",
"48.823042",
"2.365907"
],
[
"Crédit Mutuel Du Centre ",
"banques",
"agence de Pithiviers 33 r Am Gourdon 45300 PITHIVIERS",
"0820834080",
"48.703042",
"2.145907"
]
]
}
NSDictionary *allThemesDict=[[request responseString]JSONValue];
NSArray *allThemesValues=[allThemesDict objectForKey:@"themes"];
for (int i=0; i<[allThemesValues count]; i++) {
NSDictionary *currentTheme=[allThemesValues objectAtIndex:i];//here i get the first 6 values, how can i display it?
}
NSDictionary *allThemesDict = [[request responseString] JSONValue];
NSArray *allThemesValues = [allThemesDict objectForKey:@"themes"];
for (int i=0; i<[allThemesValues count]; i++) {
NSArray *currentTheme = [allThemesValues objectAtIndex:i];
NSLog(@"currentTheme = %@", currentTheme);
// Then access [currentTheme objectAtIndex:1] for example to get "mairies" in the first case.
}
for (id key in myDictionary) {
//...
}
NSDictionary *currentTheme=[allThemesValues objectAtIndex:i];
for (id item in currentTheme) {
NSLog(@"item: %@", item);
}
}