Combining or chaining mappers
olcayertas opened this issue · comments
Olcay Ertaş commented
Is it possible to combine mappers. For example I want to use both title mapper:
+ (JSONKeyMapper *)keyMapper
{
return [JSONKeyMapper mapperForTitleCase];
}
and key mapping:
+ (JSONKeyMapper *)keyMapper {
return [[JSONKeyMapper alloc] initWithModelToJSONDictionary:@{
@"id": @"orderId",
@"productName": @"orderDetails.name",
@"price": @"orderDetails.price.usd"
}];
}
James Billingham commented
Yes, you just use a 'base mapper' - https://github.com/jsonmodel/jsonmodel/blob/master/JSONModel/JSONModelTransformations/JSONKeyMapper.h#L94
James Billingham commented
Or obviously you can just implement a block-based mapper: https://github.com/jsonmodel/jsonmodel/blob/master/JSONModel/JSONModelTransformations/JSONKeyMapper.h#L70
and just chain it within your code