首页 > 代码库 > JSON解析问题

JSON解析问题

这是data.chatFileModelJson = [dic valueForKey:@"Text"];

{

    Content = "s\U5de5\U56fd\U4e2d\U53e5\U53f7\U4e2d\U56fdd";

    FileKey = "";

    Url = "http://m.im2x.com/d";

}

想要不转码的string json

 {

            "Content": "下雨了?what?",

            "Url": "http://m.im2x.com/d",

            "FileKey": ""

  }



今天在解析json时遇到了一个问题,用NSStringJSONValue方法来获取转换后的NSDictionaryNSArray)对象时,NSDictionary中的数据会转码,由于数据库中保存这个NSDictionary中的json,在其它地方要对这个NSDictionary中的json进行解析,就会出错,解决方法也很简单,使用NSDictionaryNSArray)的JSONRepresentation方法来获取JSONNSString字符串就可以了。