iOS 字典转json字符串

  • Post author:
  • Post category:其他


NSDictionary *param = @{@"key1":@"value1",@"key2":@"value2"};
NSError *parseError = nil;
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:param options:NSJSONWritingPrettyPrinted error:&parseError];
    NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

转载于:https://www.cnblogs.com/damiao/p/5158176.html