taiyang2014

iOS 字符串转son  json转字符串

+ (NSString*)dictionaryToJson:(NSDictionary *)dic
{
    NSError *parseError = nil;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
    return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
************************************
self.dataDic = [NSDictionarydictionaryWithDictionary:responseData[@"data"]];
            NSString *jsonString = responseData[@"data"][@"visitRemarks"];
            NSError *err;
            NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
            noteArray = [NSJSONSerialization JSONObjectWithData:jsonData  options:NSJSONReadingMutableContainers error:&err];
           

posted on 2016-09-26 17:23  taiyang2014  阅读(666)  评论(0编辑  收藏  举报

导航