我正在創建一個簡單的登錄頁面。在我的項目中,我想解析json字符串。但它給了我下面的錯誤。Json解析失敗
-JSONValue failed. Error trace is: (
"Error Domain=org.brautaset.JSON.ErrorDomain Code=4
\"Valid fragment, but not JSON\"
UserInfo=0xa6e70a0 {NSLocalizedDescription=Valid fragment, but not JSON}"
在我的代碼,如果我把另一個json字符串比它工作。而且我的原始json字符串正在給我瀏覽器中的數據。那麼該怎麼辦?
我的代碼是:
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://dev.bevbucks.com/gbs/api.json/[email protected]&pwd=verma!pris"]];
NSURLResponse *response = nil;
NSError *error = nil;
//getting the data
NSData *newData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
//json parse
NSString *responseString = [[NSString alloc] initWithData:newData encoding:NSUTF8StringEncoding];
NSDictionary *jsonObject = [responseString JSONValue];
NSLog(@"type : %@", jsonObject );
請把JSON,和你的代碼... – 2013-03-07 13:12:25
@ V.J。請檢查我的代碼... – Sam 2013-03-07 13:16:55
這個返回「60ee094456b6fc03f386af50c443b471」,這是一個錯誤的JSON合成... – 2013-03-08 05:32:28