priore

NSDictionary to JSON

Apr 4th, 2014
586
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