iOS学习笔记(7)——解析json中的中文

1     NSURL *url = [NSURL URLWithString:@"http://nycode.sinaapp.com/d.php"];
2     NSError *error = nil;
3 
4     NSURLRequest *request = [NSURLRequest requestWithURL:url];
5     NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
6     NSDictionary *arr = [NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableLeaves error:&error];
7   
8     NSLog(@"%@", arr);
9     NSLog(@"%@", [arr objectForKey:@"name"]);

json数据中有中文字符直接打印字典会显示unicode,用key访问可访问中文字符串

原文地址:https://www.cnblogs.com/nycoder/p/4396337.html