NSString *filePath = [[NSBundle mainBundle]pathForResource:@"students" ofType:@"json"];
NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:filePath options:NSDataReadingMappedIfSafe error:&error];
NSArray *tmpArr = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
self.students = [NSMutableArray new];
Student *student = nil;
for (NSDictionary *stu in tmpArr) {
student = [Student new];
student.name = stu[@"name"];
student.age = [stu[@"age"]integerValue];
student.gender = stu[@"gender"];
student.remark = stu[@"remark"];
[self.students addObject:student];
}
NSLog(@"%@", self.students);
ios5之后才有