我开会分析JSON的问题,我有一个JSON这样的:的iOS分析特定JSON
{
"id": 0,
"message": "ok"
}
我试过几件事情要想方设法把“ID”的值,“消息” ,但我一直有一个错误..
我该怎么做,请选择“ID”和“消息”的价值?
(我得到了我JSON
在NSMutableArray
结果)
编辑:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]];
NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
NSError *jsonParsingError = nil;
NSMutableDictionary *publicTimeline = [NSJSONSerialization JSONObjectWithData:response options:0 error:&jsonParsingError];
NSMutableArray *sortedArray = [NSMutableArray arrayWithArray:publicTimeline.allKeys];
[sortedArray sortUsingSelector:@selector(localizedStandardCompare:)];
return sortedArray;
您提供的JSON格式为“NSDictionary”。解析JSON到'NSDictionary'并使用'[responseDictionary valueForKey:@“message”]' – Akhilrajtr 2014-08-28 12:10:53
你能显示你的代码吗? – Bhupesh 2014-08-28 12:12:18
我使用它来执行web服务并获取jSON: 我编辑了我的帖子。 – deveLost 2014-08-28 12:13:41