iOS 将json文件转为plist文件

 NSString *path = [[NSBundle mainBundle] pathForResource:@"address.json" ofType:nil];
    NSLog(@"path = %@",path);

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

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

    [array writeToFile:newPath atomically:YES];

你可能感兴趣的:(iOS)