我JSON字符串转换字典
{
abstract = "Today P.M of India Mr. Narender Modi visited for the eve of Agarasen \njayanti
\n";
created = 1444733102;
imgUrl = "";
nid = 12;
title = "Latest news";
}
的字符串格式我想转换为NSDictionary中
NSError *jsonError;
NSData *objectData = [[[tableDataArray objectAtIndex:indexPath.row]objectForKey:@"NewsValue"] dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:objectData options:NSJSONReadingMutableContainers error:&jsonError];
NSLog(@"%@",json);
他们给予的反应是空请帮助。
它从哪里来? web服务 – Jamil
如果我将您的“字符串”复制/粘贴到JSON验证器中,则不正确。你从哪里得到它?它似乎已经在NSDictionary格式。 – Larme
检查jsonError给出的内容,并检查objectData是否为空 – Iftikhar