JSON与Objective-C对象映射:BWObjectMapping

jopen 10年前

BWObjectMapping是一个非常小的Objective-C库,几乎能够自动解析JSON并将其映射到任何对象。支持 NSManagedObject。

My object

@interface User : NSObject    @property (nonatomic, strong) NSNumber *userID;  @property (nonatomic, strong) NSString *firstName;  @property (nonatomic, strong) NSDate *createdAt;    @end

My json

{      "id": 14,      "first_name": "Wernimont",      "created_at": "2013-12-12T14:11:10Z"  }
User *user = [[BWObjectMapper shared] objectFromJSON:JSON withObjectClass:[User class]];

项目主页:http://www.open-open.com/lib/view/home/1402192503431