AutoMapper
AutoMapper copied to clipboard
How is mapping of nested properties in collections performed?
Given this
var test1 = {
'array1' : [
{
'prop1': 42,
'prop2': 43
},
{
'prop1': 42,
'prop2': 43
},
{
'prop1': 42,
'prop2': 43
}
]
};
How do I create a mapping that adds another property to the objects in the collection?
automapper.createMap('a', 'b')
.forMember('array1.prop3 ???', function() { return 56; });
I think you can't. Only way I've been able to do this, is to create a mapping for the type in the array, and then iterate over the array and call automapper.map individually.