【发布时间】:2013-09-10 11:19:49
【问题描述】:
我的 json 响应数据格式为:-
[{"0":"1","id":"1","1":"Pradeep","name":"Pradeep","2":null,"sender":null,"3":null,"
所以要解析表格视图上的“名称”?
我自己的实现是:-
我是ios开发新手,请帮帮我
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSDictionary *allDataDictionary=[NSJSONSerialization JSONObjectWithData:webData
options:0 error:nil]; // response saved in allDataDictionary
NSDictionary *feed=[allDataDictionary objectForKey:@"feed"]; // feeds entry
NSArray *feedforentry=[feed objectForKey:@"entry"];
for(NSDictionary *diction in feedforentry)
{
NSDictionary *title=[diction objectForKey:@"title"];
NSString *label=[title objectForKey:@"label"];
[array addObject:label];
}
[[self JustConfesstable]reloadData]; // reload table
}
【问题讨论】:
-
缺少部分 JSON...
-
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData 选项:kNilOptions 错误:&jsonError]; if ([jsonObject isKindOfClass:[NSArray class]]) { arrResult = (NSArray *)jsonObject; }
-
Rinkal Rajoria 看看我的解决方案...
标签: iphone ios json uitableview