我開會分析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