using System.Collections.Generic;
public static void Main()
AssetDTO source = JsonConvert.DeserializeObject<AssetDTO>(json);
MapperConfiguration _config = new MapperConfiguration(cfg =>
cfg.CreateMap<AssetDTO, Asset>()
.ForMember(dest => dest.Code, opt => opt.MapFrom(src => src.Code))
.ForMember(dest => dest.CodeType, opt => opt.MapFrom(src => src.CodeType))
.ForPath(dest => dest.Value, opt => opt.MapFrom(src => src.Data.Value))
.ForPath(dest => dest.Flow, opt => opt.MapFrom(src => src.Data.Flow));
IMapper _mapper = _config.CreateMapper();
Asset destination = _mapper.Map<Asset>(source);
Console.WriteLine(JsonConvert.SerializeObject(destination, Formatting.Indented));
public string Code { get; set; }
public string CodeType { get; set; }
public MetricDataDTO Data { get; set; }
public class MetricDataDTO
public string Value { get; set; }
public string Flow { get; set; }
public string Code { get; set; }
public string CodeType { get; set; }
public string Value { get; set; }
public string Flow { get; set; }