IOS中的JSON数据的解析

2023-06-20,,

解析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 *]

IOS中的JSON数据的解析的相关教程结束。

《IOS中的JSON数据的解析.doc》

下载本文的Word格式文档,以方便收藏与打印。