iOS 字典转json字符串

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];

 

posted @ 2016-01-25 18:06  嗷大喵  阅读(8087)  评论(0编辑  收藏  举报