0
我使用SBJSON解析器解析的JSON響應:使用此代碼SBJSON失去引號
{"status":0,"sessions":[{"name":"kldlksdklsdkl","active":false,"status":"saved","type":"web","key":"30228ee71f09b93aaa2d1738","contributor_id":"lance","created_at":"Mon May 02, 2011 02:35 PM","closed_at":"Mon May 02, 2011 02:46 PM"}{"name":"Blahieririe","active":false,"status":"saved","type":"web","key":"dbd2bbcc8681bba6a6532051","contributor_id":"lance","created_at":"Mon May 02, 2011 01:42 PM","closed_at":"Mon May 02, 2011 02:34 PM"},{"name":"Jim","active":false,"status":"saved","type":"web","key":"ec5bcf18356a29bb4490841f","contributor_id":"lance","created_at":"Fri April 29, 2011 02:37 PM","closed_at":"Fri April 29, 2011 02:38 PM"}]}
從服務器:
NSArray *sessionsArray = [dictionary objectForKey:@"sessions"];
NSArray *tempArray = [[NSArray alloc] init];
for(NSString *item in sessionsArray){
NSLog(@"Session Found: \'%@\'",item);
NSDictionary *myDictionary = [item JSONValue];
}
我碰到一個不錯的陣列我JSON,但當我試圖把每一塊放入一個NSDictionary,它給了我一個例外,我NSLoged它,並發現引號正在從一些鍵和/或值被刪除如下所示:
{
active = 1;
"contributor_id" = lance;
"created_at" = "Mon May 02, 2011 03:26 PM";
key = e10e5feeea3425ae213cb4cc;
name = "JSON TEST";
status = active;
type = web;
}
它是JSON解析器中的錯誤嗎?還是我在做一些愚蠢的事情?
謝謝主席先生!工作很棒:) – Lance 2011-05-04 21:22:58