How to parse NSDictionary data from JSONValue
I have a NSDictionary made up of the daily trend from twitter (made up of JSON). However there is a problem blocking my way. Before I can get to any data, I need to firstly get through th开发者_如何转开发e first key named @"trends". That is fine and works perfectly. However to actually get to the trend itself, I need to get through a few dates. What I would like to know is how can I get the trend data without knowing the dates.
At the moment the hierachy of the NSDictionary is:
Dictionary -> key:@"trends" -> Lots of keys named as dates, i.e: 2011-04-30 02:32:34 (this is where I am stuck) -> trend data (what I need to get).
NSDictionary *trends = [yourResultFromParsingJSON objectForKey:@"trends"];
[trends enumerateKeysAndObjectsUsingBlock:^(NSString *trendDate, id trendData, BOOL *stop) {
// do whatever you want with trendData
}];
for(NSDictionary* key in responseDict) {
if ([key isEqual:@"abc"]) {
NSString *cookieValue = [responseDict objectForKey:@"abc"];
cookieValue = [cookieValue substringWithRange:NSMakeRange(11, 32)];
}
}
精彩评论