Permalink
Browse files

Merge pull request #1 from tonymillion/master

added category for NSData
  • Loading branch information...
MugunthKumar committed Nov 5, 2011
2 parents d3bfa5a + e55837c commit 70ff26338663bd041e43c17c66665a5ea1d9d171
Showing with 20 additions and 0 deletions.
  1. +4 −0 SBJSONCategories.h
  2. +16 −0 SBJSONCategories.m
View
@@ -27,4 +27,8 @@
- (id)JSONValue;
@end
+@interface NSData (SBJSONCategories)
+- (id)JSONValue;
+@end
+
View
@@ -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.