Skip to content

Conversation

MapleYin
Copy link

如果一个类的定义为:

@interface MJPerson : NSObject
@property (copy, nonatomic) NSString *name;
@property (nonatomic) BOOL isVIP;
@property (strong, nonatomic) NSArray<MJPerson *> *friends;
@property (strong, nonatomic) NSArray<NSString *> *books;
@end

但是给的 json 数据形如:

{
    "name": "myName",
    "isVIP": false,
    "friends": [],
    "books": ["book1", "book2", null, false, 123]
}

此时获得的模型中,books 属性就不能保证是 NSString

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant