JSON與Objective-C對象映射:BWObjectMapping

jopen 10年前發布 | 23K 次閱讀 Objective-C開發 BWObjectMapping

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.baiduhome.net/lib/view/home/1402192503431

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!