iOS & Mac JSON To Model

NSString * jsonPath=[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Contents.json"];
  NSString * jsonStr=[[NSString alloc] initWithData:[NSData dataWithContentsOfFile:jsonPath] encoding:NSUTF8StringEncoding];

NSLog(@"%@",jsonStr);
NSError * error=nil;
JSContentsModel * oneModel=[[JSContentsModel alloc] initWithString:jsonStr usingEncoding:NSUTF8StringEncoding error:&error];
posted @ 2015-09-15 15:19  springday  阅读(174)  评论(0编辑  收藏  举报