user831679
user831679

Reputation:

JSON data for iOS 5

Here how I am trying to get the data from JSon in iOS-5

    NSMutableDictionary *list =[NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];

NSLog(@"VLIST: %@", list);

NSString *vList = [list objectForKey:@"DEMO"];

NSLog(@"List %@", vList);

And getting the output:

VLIST: { DEMO = (34DL3611, 34GF0512, 34HH1734, 34HH1736, 34YCJ15):}
List (34DL3611, 34GF0512, 34HH1734, 34HH1736, 34YCJ15)

What I want to know that how can I get the name of this object, which is "DEMO", so that I would use it to display and then want to get this List to be used for Tableview.

Upvotes: 0

Views: 236

Answers (1)

Felix Kling
Felix Kling

Reputation: 817238

NSDictionary [docs] has a method allKeys which returns an array containing all keys in the dictionary. Or you use getObjects:andKeys: to get both at the same time.

Upvotes: 1

Related Questions