我需要幫助。如何檢索一個NSArray/NSDictionary的JSON參數
這是我的JSON webservice http://webservice.creaworld.sg/vesselservice.ashx?test。
選擇方法getdatasetmem_serialize注意JSON數據中有一個反斜槓或轉義字符。
爲什麼會發生這種情況?以及如何檢索Xcode中的值i_member_id
?我知道檢索到的JSON數據「表」是一個數組,它有2個字典。
我需要幫助。如何檢索一個NSArray/NSDictionary的JSON參數
這是我的JSON webservice http://webservice.creaworld.sg/vesselservice.ashx?test。
選擇方法getdatasetmem_serialize注意JSON數據中有一個反斜槓或轉義字符。
爲什麼會發生這種情況?以及如何檢索Xcode中的值i_member_id
?我知道檢索到的JSON數據「表」是一個數組,它有2個字典。
爲什麼你需要解析序列化的響應?你能解析正常的JSON嗎?
NSError *error;
NSDictionary *json = [parser objectWithString:content error:&error];
if (json == nil) {
UIAlertView *errorAlert = [[UIAlertView alloc]
initWithTitle:@"Error"
message:[error localizedDescription]
delegate:self cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
[errorAlert show];
[errorAlert autorelease];
} else {
NSArray *trends = [json objectForKey:@"trends"];
for (NSDictionary *trend in trends) {
[viewController.names addObject:[trend objectForKey:@"name"]];
[viewController.urls addObject:[trend objectForKey:@"url"]];
}
}
嗨,大家好,答案不起作用,我仍然無法檢索objectforkeyvalue,發現Web上的另一個json服務示例http://www.raboof.com/Projects/Jayrock/demo.ashx?去「getdataset」方法,我如何檢索員工的名字,姓氏等? – user565629 2011-01-07 01:33:08
該Web服務提供的序列化版本是包含JSON數據的JSON(或C)字符串,因此它們爲何被轉義。你不能使用非序列化版本嗎? – 2011-01-06 16:07:59