There are two JSONModels-Question and Option. Question model has following property.
@property NSArray<Option *> *optionsArray;
and keyMapper
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"options": @"optionsArray",
}];
}
And Option model has following keyMapper
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithDictionary:@{
@"option_id":@"optionID", @"value":@"optionValuesDictionary"
}];
}
The question is
[[Question alloc] initWithDictionary:questionDictionary error:&parseError];
is returning a question object with optionArray(There are elements in the array, not empty). But each element in that array is an NSDictionary. Not Option model with proper keymapping. Why is it like that?