Skip to content

Instantly share code, notes, and snippets.

@iandundas
Created May 20, 2013 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iandundas/5610464 to your computer and use it in GitHub Desktop.
Save iandundas/5610464 to your computer and use it in GitHub Desktop.
NSJSONSerialization usage
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:@"Object", @"Key" , nil];
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:data options:0 error:nil]; // can give option NSJSONWritingPrettyPrinted
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment