2015-04-06 129 views
-2

如何在標籤上打印密鑰event_id如何從jSON中讀取密鑰

"all_data" =  (
      { 
     "company_logo" = "http://mbdbtechnology.com/projects/officeapp/uploads/event/Voxev\U00e6rket_logo_stort.png"; 
     "event_id" = 8; 
     "event_name" = "Dit nye kontor i Voxev\U00e6rket"; 
     "event_sort_desc" = "Voxev\U00e6rket tilbyder landsd\U00e6kkende kontorer til ny opstartede"; 
    }, 
      { 
     "company_logo" = "http://mbdbtechnology.com/projects/officeapp/uploads/event/Image_jpg_2_288X200.jpg"; 
     "event_id" = 7; 
     "event_name" = "Sunday Special only for women"; 
     "event_sort_desc" = "Declarations of war At midnight on 31 July \U2013 1 Aug, French 2"; 
    }, 
+2

你需要採取一切你的問題是出題的,澄清,並將其包含在問題的機構。使用您的問題下的編輯鏈接來實現此目的。 – 2015-04-06 11:04:32

+0

你解析了jSON。告訴我們你已經做了什麼。 – ShahiM 2015-04-06 11:45:42

回答

0

試試這個:

NSMutableDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:responseData options:kNilOptions error:&error]; 
//responseData is an NSData object containing the jSON 

NSMutableArray *allData = [jsonDict objectForKey:@"all_data"]; 

for (NSDictionary* dict in allData) 
{ 
    NSString *eventID = [dict objectForKey:@"event_id"]; 
    NSLog(@"event ID : %@",eventID); 
}