2011-07-11 206 views
-2

欲解析以下給出的所有在然後陣列中iPhone應用程序用來顯示JSON數據解析

http://www.krsconnect.no/community/api.html?method=fullEvents&appid=620 SBJsonParser *解析器= [[SBJsonParser的alloc] INIT]所述數據; NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString:@「http://www.krsconnect.no/community/api.html?method=fullEvents & appid = 620」]]; NSData * response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; NSString * json_string = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding]; NSDictionary * object = [parser objectWithString:json_string error:nil];

NSArray *results = [parser objectWithString:json_string error:nil]; 





NSDictionary *dictOne = [results objectAtIndex:0]; 

NSArray *activitiesArray = [dictOne objectForKey:@"activities"]; 



NSDictionary *dictTwo = [activitiesArray objectAtIndex:0]; 
NSDictionary *eventDict = [dictTwo objectForKey:@"event"]; 



NSDictionary *dictThree = [activitiesArray objectAtIndex:0]; 
NSDictionary *eventDict3 = [dictThree objectForKey:@"images"]; 









NSLog(@"%@ - %@", [eventDict3 objectForKey:@"large"]); 





NSLog(@"%@ - %@", [eventDict objectForKey:@"category"]); 
NSLog(@"%@ - %@", [eventDict objectForKey:@"content"]); 
+0

...問題是? – microspino

+0

那該如何解析這個 – Ali

+0

如何解析一下? – JeremyP

回答

0

它的工作正常,但如果我從日期打印HoursFrom反對這不是因爲在您的數據打印

那將是它的hoursFrom,不HoursFrom。這個案子很重要。

+0

謝謝你能告訴我,如何可以打印所有在這個json的類別,現在它只是只打印兩個 – Ali