json文件转换plist文件

NSString  *path = [[NSBundle mainBundle]pathForResource:@"city_province.json"ofType:nil];

NSLog(@"path = %@",path);

NSArray *array1 = [NSJSONSerialization JSONObjectWithData:[NSData dataWithContentsOfFile:path]options:NSJSONReadingMutableLeaves error:nil];

NSString *newPath = [NSString stringWithFormat:@"%@%@",[[NSBundle mainBundle]bundlePath],@"/city_province.plist"];

NSLog(@"newPath = %@", newPath);

[array1 writeToFile:newPath atomically:YES];

你可能感兴趣的:(json文件转换plist文件)