This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"data" ofType:@"json"]; | |
NSString *jsonString = [[NSString alloc] initWithContentsOfFile:path encoding:NSUTF8StringEncoding error:NULL]; | |
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; | |
NSDictionary *json = [self parseJSON:jsonData]; | |
} | |
- (NSMutableDictionary *)parseJSON:(NSData *)data | |
{ | |
NSError* jsonParsingError; | |
return [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonParsingError]; | |
} |