我的 JSON 解析代码:
// Store incoming data into a string
NSString *jsonString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
// Create a dictionary from the JSON string
NSDictionary *results = [jsonString JSONValue];
NSLog(@"%@",jsonString);
当我调试代码时,我得到 jsonString ,但得到0个键值对。 和错误:
-JSONValue失败。错误跟踪是:( “Error Domain = org.brautaset.JSON.ErrorDomain Code = 5 \”非转义控制字符'0x0'\“UserInfo = 0x4d2e030 {NSLocalizedDescription =未转义的控制字符'0x0'}“, “Error Domain = org.brautaset.JSON.ErrorDomain Code = 3 \”key的预期对象值:id \“UserInfo = 0x4d2e130 {NSUnderlyingError = 0x4d2e090 \“非转义控制字符'0x0'\”,NSLocalizedDescription = Object 密钥的预期值:id}“, “Error Domain = org.brautaset.JSON.ErrorDomain Code = 3 \”解析数组时的预期值\“UserInfo = 0x4d2e180 {NSUnderlyingError = 0x4d2e110 \“密钥期望的对象值:id \”, NSLocalizedDescription =解析数组时的预期值}“, “Error Domain = org.brautaset.JSON.ErrorDomain Code = 3 \”密钥的预期对象值:predictions \“UserInfo = 0x4d2e250 {NSUnderlyingError = 0x4d2e210 \“解析数组时的预期值\”, NSLocalizedDescription =密钥:预测的预期对象值}“