SHARE
TWEET

NSDictionary to JSON

priore Apr 4th, 2014 495 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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top