IOS中的JSON数据的解析

时间:2023-01-25 21:16:44

解析Json数据

 //加载.json文件
NSString *path = [[NSBundle mainBundle]pathForResource:@"product.json" ofType:nil];
//根据路径加载json文件到nsdata中
NSData *data = [NSData dataWithContentsOfFile:(path)];
//将加载进来的nsdata数据转换为OC中对应的对象
[NSJSONSerialization JSONObjectWithData:(NSData *) options:(NSJSONReadingOptions) error:(NSError *__autoreleasing *)];

UIWebView

 [webView loadRequest:NSURLRequest *]