Permalink
Browse files

Add support for NSJSONSerialization

  • Loading branch information...
1 parent e0d9c5b commit 719dd42890fa9c007e777477039dda57ce9cfe6c @Pretz Pretz committed Oct 26, 2011
Showing with 14 additions and 0 deletions.
  1. +13 −0 Classes/JSONTest.m
  2. +1 −0 README.md
View
13 Classes/JSONTest.m
@@ -69,12 +69,25 @@ - (void)nextiveJsonTest:(NSString *)resourceName count:(NSInteger)count {
[JSONData release];
}
+- (void)NSJSONSerializationTest:(NSString *)resourceName count:(NSInteger)count {
+ NSData *JSONData = [[self loadDataFromResource:resourceName] retain];
+ NSError *error = nil;
+ RunWithCount(count, ([NSString stringWithFormat:@"NSJSONSerialization-%@", resourceName]), {
+ [NSJSONSerialization JSONObjectWithData:JSONData options:0 error:&error];
+ });
+ NSAssert1(error == nil, @"Errored: %@", error);
+ [JSONData release];
+}
+
- (void)runWithResourceName:(NSString *)resourceName count:(NSInteger)count {
[self SBJSONTest:resourceName count:count];
[self YAJLTest:resourceName count:count];
[self touchJSONTest:resourceName count:count];
[self JSONKitTest:resourceName count:count];
[self nextiveJsonTest:resourceName count:count];
+ if (NSClassFromString(@"NSJSONSerialization")) {
+ [self NSJSONSerializationTest:resourceName count:count];
+ }
}
@end
View
1 README.md
@@ -5,5 +5,6 @@
- [YAJL (objective-C bindings)](http://github.com/gabriel/yajl-objc)
- [JSONKit](https://github.com/johnezang/JSONKit)
- [NextiveJson](https://github.com/nextive/NextiveJson)
+- [NSJSONSerialization](http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40010946)
This is a very basic test that parses some sample JSON files multiple times.

0 comments on commit 719dd42

Please sign in to comment.