【发布时间】:2016-10-08 11:27:49
【问题描述】:
如何解决这个我尝试了很多次但无法获取“business_details”数组的 JSON 数组。我只获取第一个“business_category_name” 然后“business_details”数组不获取。 我认为无法正确解释,请尝试理解并帮助我。 我很累
Json
"status": [
{
"business_category_name": "Banks\/Credit Unions\/Landers",
"business_details": [
{
"img_url": "http:\/\/edutimeapp.com\/toshow\/chamber-of-commerc\/member-logo\/1464667619-pnc.jpg",
"name": "PNC Bank",
"des": "PNC offers a wide range of services for all our customers, from individuals and small businesses, to corporations and government entities",
"address": "",
"email": "andrea.kendall@pnc.com",
"phone": "260-422-5922",
"member_since": "2016-05-31",
"img_company": "http:\/\/edutimeapp.com\/toshow\/chamber-of-commerc\/member-logo\/1464667619-pnc.jpg",
"website": "",
"city": "Fort Wayne",
"state": "IN",
"zip": "46808"
}
]
},
{
"business_category_name": "Cleaning Services",
"business_details": [
{
"img_url": "http:\/\/edutimeapp.com\/toshow\/chamber-of-commerc\/uploads\/logo250.png",
"name": "tsst company",
"des": "rudurgg ",
"address": "2005 s calhoun ",
"email": "",
"phone": "2602496687",
"member_since": "2016-05-31",
"img_company": "http:\/\/edutimeapp.com\/toshow\/chamber-of-commerc\/uploads\/logo250.png",
"website": "",
"city": "fort wayne",
"state": "in",
"zip": "46825"
}
]
},
使用 Json 数据
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSError *error;
NSLog(@"Error in receiving data %@",error);
NSMutableDictionary *json = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:&error];
NSLog(@"response data %@",json);
NSArray *results = [json objectForKey:@"status"];
namearray= [results valueForKey:@"business_category_name"];
emailarray = [results valueForKey:@"email"];
[self.tableview reloadData];
}
【问题讨论】:
标签: objective-c arrays json xcode uitableview