看来您的服务器发送了“嵌套JSON”:
jsonResponse是JSON 字符串 (不是 dictionary
)。该字符串的值再次是表示字典的JSON数据。
在这种情况下,您必须两次反序列化JSON:
NSString *jsonString = [NSJSonSerialization JSONObjectWithdata:jsonResponse options:NSJSonReadingAllowFragments error:nil];NSData *innerJson = [jsonString dataUsingEncoding:NSUTF8StringEncoding];NSDictionary *jsonDict = [NSJSonSerialization JSONObjectWithdata:innerJson options:0 error:nil];NSString *email = jsonDict[@"email"];



