在iphone中使用json解析文本文件
如何使用iphone中的“JSON”解析器解析存储在资源文件夹中的文本文件“.txt”? 如有任何建议,将不胜感激。在iphone中使用json解析文本文件,iphone,ios,json,parsing,Iphone,Ios,Json,Parsing,如何使用iphone中的“JSON”解析器解析存储在资源文件夹中的文本文件“.txt”? 如有任何建议,将不胜感激。 谢谢Neha Mehta。加载文本文件..并初始化JSON..简单 NSString *textPAth = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"txt"]; NSError *error; NSString *content = [NSString stringWithCo
谢谢Neha Mehta。加载文本文件..并初始化JSON..简单
NSString *textPAth = [[NSBundle mainBundle] pathForResource:@"content" ofType:@"txt"];
NSError *error;
NSString *content = [NSString stringWithContentsOfFile:textPAth encoding:NSUTF8StringEncoding error:&error]; //error checking omitted
SBJsonParser *parser = [[SBJsonParser alloc] init];
NSDictionary *json = [parser objectWithString: content];
欢迎来到堆栈溢出。请阅读,然后。