jsonmodel / jsonmodel

Magical Data Modeling Framework for JSON - allows rapid creation of smart data models. You can use it in your iOS, macOS, watchOS and tvOS apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Combining or chaining mappers

olcayertas opened this issue · comments

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"
	}];
}

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