[
{
"c_name" : "r",
"email_id" : "r",
"phn_no" : "2",
"c_id" : "1"
},
{
"c_name" : "e",
"email_id" : "e",
"phn_no" : "4",
"c_id" : "2"
}
]
這是我作爲JSON字符串接收的輸出數據。現在我怎樣才能訪問這些數據?我用NSJSONSerialization
類:如何從JSON字符串
NSError *writeError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:arr_mcontacts options:NSJSONWritingPrettyPrinted error:&writeError];
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
NSLog(@"JSON Output: %@",jsonString);
你已經有數據的JSON。這是你的'arr_mcontacts'之前你序列化爲json。 – dan
從字面上有成百上千的過去如何解析使用NSJSONSerialization JSON數據的問題。在所有這些問題中,哪些具體的部分特別是你可能不知道該怎麼做?你到目前爲止嘗試做什麼? – Gruntcakes