我正在创建一个简单的登录页面。在我的项目中,我想解析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