+(NSString*)dictionaryToJson:(NSDictionary *)dic
{
NSError *parseError = nil;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
if(parseError) {
NSLog(@"dic解析失败:%@",parseError);
return nil;
}
return [[[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding] stringByReplacingOccurrencesOfString:@"\n" withString:@""] stringByReplacingOccurrencesOfString:@" " withString:@""];
}
版权声明:本文为jp940110jpjp原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。