Skip to content

Commit

Permalink
- added NSArray/NSSet support to view JSON serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
olarivain committed Jun 22, 2012
1 parent 470c1d6 commit e1d0180
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/ViewJSONSerializer.m
Expand Up @@ -18,6 +18,16 @@ + (NSObject *) jsonify: (id<NSObject>) obj {
[obj isKindOfClass: NSNumber.class]) {
return obj;
}

if([obj isKindOfClass: NSArray.class] || [obj isKindOfClass: NSSet.class]) {
NSMutableArray *array = [NSMutableArray array];
for(id subObject in (id<NSFastEnumeration>) obj) {
id subJson = [ViewJSONSerializer jsonify: subObject];
[array addObject: subJson];
}
return array;
}


if( [obj isKindOfClass: NSValue.class] ) {
return [ViewJSONSerializer extractInstanceFromValue: (NSValue *) obj];
Expand Down

0 comments on commit e1d0180

Please sign in to comment.