Skip to content

Instantly share code, notes, and snippets.

@amster
Last active August 29, 2015 13:59
Show Gist options
  • Save amster/10686852 to your computer and use it in GitHub Desktop.
Save amster/10686852 to your computer and use it in GitHub Desktop.
NSString *fileName = @"foo.json";
NSURL *documentsFolderURL = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSString *filePath = [documentsFolderURL.path stringByAppendingString:fileName];
NSString *jsonString = [[NSString alloc] initWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:NULL];
NSError *jsonError;
NSMutableDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:&jsonError];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment