JSON 数据的 JSONKit 解析
来源:互联网 发布:搞笑网络歌曲排行榜 编辑:程序博客网 时间:2024/06/05 17:41
@property (nonatomic, strong) NSMutableArray *JSONArray;
懒加载
- (NSMutableArray *)JSONArray{ if (_JSONArray == nil) { self.JSONArray = [NSMutableArray array]; } return _JSONArray;}
- (IBAction)JSONKitButtonDidClicked:(UIButton *)sender { // 1、拿到 json 文件的路径 NSString *path = [[NSBundle mainBundle] pathForResource:@"student" ofType:@"json"]; // 2、根据路径获取文件内容为 NSData 对象 NSData *data = [NSData dataWithContentsOfFile:path]; // 3、解析为数组 NSArray *array = [data objectFromJSONData]; for (NSDictionary *dict in array) { StudentModal *modal = [StudentModal new]; [modal setValuesForKeysWithDictionary:dict]; [self.JSONArray addObject:modal]; } for (StudentModal *modal in self.JSONArray) { NSLog(@"JSONArray = %@, %ld, %@", modal.name, modal.number, modal.hobby); } [self.JSONArray removeAllObjects]; // 把OC里面的数据类型转化成 json 串 NSString *yadong; [yadong JSONString]; NSArray *testArray = @[@"wewe", @"www", @"qq"]; NSString *result = [testArray JSONString]; NSLog(@"result = %@", result);}
0 0
- JSON 数据的 JSONKit 解析
- JSONKit、Alamofire、AFNetworking解析json数据
- JSon解析之JSonKit
- jsonkit 解析本地数据
- iOS之JSONKit解析JSON
- JSONKit 解析逗号冗余的json字符串失败
- 解析json对象,使用的类库jsonkit,但解析完成后,再次使用解析的数据时会导致tableview崩溃
- 数据解析(三)解析JSON-----系统自带NSJSONSerialization 与 第三方JSONKit
- IOS JSON解析之JSONKit使用
- IOS JSON解析之JSONKit使用
- IOS JSON解析之JSONKit使用
- IOS JSON解析之JSONKit使用
- json解析使用第三方类库JSONKit
- IOS JSON解析之JSONKit使用
- IOS--JSON解析之JSONKit使用
- JSON解析详解(JSONKit、苹果自带解析)和PList文件的反序列化
- IOS中Json解析的四种方法,推荐使用原生解析,和jsonKit
- 利用ASIHTTPRequest请求java服务和JSONKit解析返回的json串
- js正则表达式校验金额
- easyui删除多行问题
- 图像的放大与缩小——双线性插值放大与均值缩小
- Python的lambda函数与排序
- OC_图片放大缩小_移动手势综合
- JSON 数据的 JSONKit 解析
- GRE写作必备句型
- 杭电 2005 第几天
- NSString的使用
- 集合ArrayList类的使用和与其他实现类的区别
- 服务的用法
- 汇编贪食蛇
- EasyUI获取DataGrid中某一列的所有值
- http://blog.sina.com.cn/s/blog_877e9c3c0101gpnz.html