Skip to content

Instantly share code, notes, and snippets.

@ChristianKienle
Created December 31, 2012 18:24
Show Gist options
  • Select an option

  • Save ChristianKienle/4421831 to your computer and use it in GitHub Desktop.

Select an option

Save ChristianKienle/4421831 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface NSDictionary (CMKJSONSerializationAdditions)
#pragma mark - Creating JSON Data
// same semantics as +dataWithJSONObject:options:error: (NSJSONSerialization)
- (NSData *)JSONDataWithOptions:(NSJSONWritingOptions)options
error_cmk:(NSError **)error;
// same semantics as +writeJSONObject:toStream:options:error: (NSJSONSerialization)
- (NSInteger)writeJSONObjectToStream:(NSOutputStream *)stream
options:(NSJSONWritingOptions)options
error_cmk:(NSError **)error;
// same semantics as +isValidJSONObject: (NSJSONSerialization)
- (BOOL)isValidJSONObject_cmk;
#pragma mark - Convenience
- (NSData *)JSONDataWithOptions_cmk:(NSJSONWritingOptions)options;
- (NSData *)compactJSONData_cmk;
- (NSData *)prettyPrintJSONData_cmk;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment