Skip to content

Instantly share code, notes, and snippets.

@cbowns cbowns/gist:2706112
Created May 15, 2012

Embed
What would you like to do?
Nil-guarded dictionary key-value retrieval for JSON responses
// JSON is dangerous, take one of these!
+ (id)nullGuardedDict:(NSDictionary *)dict valueForKey:(NSString *)key;
{
id obj = nil;
obj = [dict valueForKey:key];
if (obj == [NSNull null]) {
obj = nil;
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.