iOS 数组/字典转json
来源:互联网 发布:云影源码1llo 编辑:程序博客网 时间:2024/05/16 13:28
NSMutableArray *tempArr = [NSMutableArray array]; //这里不要用for-in 先找到模型,然后给可变字典赋值,最后装到数组里 NSMutableDictionary *dic = [NSMutableDictionary dictionary]; for (int i = 0; i < self.dataSourceArr.count; i++) { PerponModel *model = self.dataSourceArr[i]; [dic setValue:model.name forKey:@"realname"]; [dic setValue:model.phoneNumber forKey:@"mobile"]; [tempArr addObject:dic]; } //dataWithJSONObject:后面这个是一个id类型的这样放数组就转数组,字典就转字典 //NSJSONWritingPrettyPrinted是一个枚举 NSData *data = [NSJSONSerialization dataWithJSONObject:tempArr options:NSJSONWritingPrettyPrinted error:nil]; NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
阅读全文
0 0
- iOS 数组/字典转json
- ios字典与数组转JSon
- iOS数组和字典转Json字符串
- IOS 数组/字典转json串
- iOS字典或数组转JSON
- 数组 字典转Json
- iOS JSON转字典
- iOS json格式的字符串转字典或数组
- iOS对象(字典或数组)转json串
- 字典转JSON和 数组转JSON
- iOS开发-字典转json
- iOS中 字典转Json
- iOS 字典转JSON字符串
- iOS 系统自带JSON转字典 字典转JSON
- iOS 数组/字典转模型
- 数组、字典转json格式字符串
- iOS对象(字典或数组)转化为JSon字符串
- iOS字典对象和数组对象转成json
- Maven中的-D(Properties属性)和-P(Profiles配置文件)
- 生成论文参考文献
- Android Studio运行程序出现Session ‘app’: Error Launching activity 解决办法
- LeetCode#238. Product of Array Except Self
- 面向对象程序设计概论
- iOS 数组/字典转json
- zookeeper+kafka
- GDI
- 集合类复习
- Lintcode——两数之和
- 【tarjan】17.6.1 仙人球 题解
- shell 数组 循环
- 群辉
- 1002. A+B for Polynomials (25)