Advertisement
priore

NSDictionary to JSON

Apr 4th, 2014
1,057
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. NSDictionary *dict = [NSDictionary new]; // source
  2. NSData *json_data = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:nil];
  3. NSString *json = [[NSString alloc] initWithData:json_data encoding:NSUTF8StringEncoding];
  4. NSLog(@"%@", json);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement