iOS JSON文件转Plist文件


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

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

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

    [array writeToFile:newPath atomically:YES];

//注:打印的路径找不到文件,可以尝试搜索本机可找到该文件

你可能感兴趣的:(iOS JSON文件转Plist文件)