NSArray Tokenize基于密钥

我已经从服务器获取数据,并传递数据NSJSONSerializationNSMutableArray也填充。

数组的输出如下:

 NSArray *jsonArray = (NSArray *)json; NSLog(@"Array - %@",jsonArray); 

我想创build一个新的数组,其中将包含通讯的所有数据。

 Array - ( { error = 0; newsletter = ( { date = "2015-11-23"; description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop p"; id = 42; image = "link/uploads/14482883361619729430.png"; "post_count" = 1; "posted_by" = admin; title = Testing; }, { date = "2015-11-23"; description = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop p"; id = 43; image = "link/uploads/14483023241983843096.png"; "post_count" = 0; "posted_by" = admin; title = "Lorem Ipsum"; }, 

我试图使用函数objectAtIndex但没有工作,我正在检查jsonArray的计数。

 NSLog(@"count of array - %lu",jsonArray); 

它显示2作为柜台。

我的代码:

 if (responseData != nil) { NSMutableArray *json = [NSJSONSerialization JSONObjectWithData:responseData //1 options:NSJSONReadingMutableContainers error:&err]; NSArray *jsonArray = (NSArray *)json; NSLog(@"Array - %@",jsonArray); NSLog(@"Count %lu",[jsonArray count]); } 

问题已更新:

我想填充两个数组1将有error = 0; 第二个应该需要所有的数据在通讯

 = ( { date = "2015-11-23"; description = "Lorem Ipsum is simply..."; id = 42; image = "link/uploads/14482883361619729430.png"; "post_count" = 1; "posted_by" = admin; title = Testing; } 

希望现在的问题有点清楚…

提前感谢您的理解问题。

这个问题不应该是“我想有两个数组 – 一个是错误的,一个是所有的数据”,因为两个都不是数组。

错误只是一个数字,通讯数据是一个包含键值对的字典,您可以通过键的值访问

 NSString* newsletterDate = newsletterData[@"date"] 

所以,只要得到你的JSON数组的第二个对象 – 它将是一个字典,你可以通过各自的键访问它的所有数据。