iOS 字符串转son json转字符串
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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];
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];
NSError *err;
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
noteArray = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
以上是关于iOS 字符串转son json转字符串的主要内容,如果未能解决你的问题,请参考以下文章