本地 json檔案轉化成plist檔案
NSString *str = [[NSBundlemainBundle]pathForResource:@"sys_Area.json"ofType:nil];
NSData *data = [NSDatadataWithContentsOfFile:str];
NSArray *array = [NSJSONSerializationJSONObjectWithData:dataoptions:0error:NULL];
if( [array isKindOfClass:[NSArray class]])
{
[array writeToFile
}
NSString *path =@"/Users/zhoupengju/Desktop/sys_Type.json";
NSArray *array = [NSJSONSerializationJSONObjectWithData:[NSDatadataWithContentsOfFile:path] options:NSJSONReadingMutableLeaveserror:nil];
[array writeToFile:@"/Users/zhoupengju/Desktop/sys_Type.plist"atomically
if( [json_data isKindOfClass:[NSArray class]]) {
NSLog(@"这是一个数组%@", json_data);
//把json转化戕plist NSArray * arr = json_data;
[arr writeToFile:@"/Users/qianfeng/Documents/json.plist" atomically:YES]; }
else if([json_data isKindOfClass:[NSDictionary class]]) {
NSLog(@"这是一个å—å…¸%@", json_data);
NSDictionary * dic = json_data;
[dic writeToFile:@"/Users/qianfeng/Documents/json.plist" atomically:YES];