iOS JSON NSString Convert to NSDictionary
NSString *str = @"{\"info\":{\"body\":\"这个里面是是测试代码,里面有二个图片<!--img#0--><br/><!--img#1-->\",\"img\":[{\"ref\":\"<!--img#0-->\",\"src\":\"http://img.baidu.com/img/iknow/wenku/huazhang315x150.jpg\"},{\"ref\":\"<!--img#1-->\",\"src\":\"http://img.baidu.com/img/iknow/wenku/lxg315X150-lxg.jpg\"}]}}"; NSError *error = nil; NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary *jsonObject = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:&error];
如果你不是在wb145230博客园看到本文,请点击查看原文.