IOS中的JSON数据的解析

解析Json数据web

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

UIWebViewjson

1 [webView loadRequest:NSURLRequest *]
相关文章
相关标签/搜索