Created
July 13, 2012 03:06
-
-
Save crowl/3102432 to your computer and use it in GitHub Desktop.
NSDictionary category to deal with nil instead of NSNull objects created by NSJSONSerialization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSDictionary+NSNullUtility.h | |
// | |
// | |
// Created by Pablo Heredia on 12-07-12. | |
// Copyright (c) 2012. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface NSDictionary (NSNullUtility) | |
- (id)notNullObjectForKey:(id)aKey; | |
@end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSDictionary+NSNullUtility.h | |
// | |
// | |
// Created by Pablo Heredia on 12-07-12. | |
// Copyright (c) 2012. All rights reserved. | |
// | |
#import "NSDictionary+NSNullUtility.h" | |
@implementation NSDictionary (NSNullUtility) | |
- (id)notNullObjectForKey:(id)aKey | |
{ | |
id object = [self objectForKey:aKey]; | |
if (object == [NSNull null]) return nil; | |
return object; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment