// //1、json转换成对象 // NSString * path = [[NSBundle mainBundle] pathForResource:@"test.json" ofType:nil]; // NSData * data = [NSData dataWithContentsOfFile:path]; // NSDictionary * dic = [ NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]; // NSArray * array = dic[@"class1"]; // // for (NSDictionary * dic in array) // { // // //2.对象转成data // NSData * data = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:nil]; // NSString * str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; // NSLog(@"%@", str); // // }