JSON (系统解析)
更新:HHH   时间:2023-1-7


  1. 获取文件路径
        NSString * jsonPath = [[NSBundle mainBundle] pathForResource:@"Student" ofType:@"json"];
       

2.初始化NSData对象
    NSData *data = [NSData dataWithContentsOfFile:jsonPath];
  

3.解析(NSJSONReadingMutableContainers) 可变的一个容器
    // NSJSONReadingMutableLeaves
    // NSJSONReadingAllowFragments
   

    NSMutableArray * arr = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil];
    NSLog(@"%@",arr);


返回开发技术教程...