Skip to content

Commit

Permalink
Merge pull request #1 from tonymillion/master
Browse files Browse the repository at this point in the history
added category for NSData
  • Loading branch information
MugunthKumar committed Nov 5, 2011
2 parents d3bfa5a + e55837c commit 70ff263
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions SBJSONCategories.h
Expand Up @@ -27,4 +27,8 @@
- (id)JSONValue;
@end

@interface NSData (SBJSONCategories)
- (id)JSONValue;
@end


16 changes: 16 additions & 0 deletions SBJSONCategories.m
Expand Up @@ -65,3 +65,19 @@ - (id)JSONValue {
}

@end

@implementation NSData (SBJSONCategories)
- (id)JSONValue
{
NSError *err = nil;
id jsonValue = [NSJSONSerialization JSONObjectWithData:self
options:0
error:&err];

if(err)
NSLog(@"%@", [err description]);

return jsonValue;
}

@end

0 comments on commit 70ff263

Please sign in to comment.