using System.Collections.Generic;
public static void Main()
MapperConfiguration _config = new MapperConfiguration(config =>
config.CreateMap<Source, List<Destination>>()
.ConvertUsing<SourceToListDestinationTypeConverter>();
""RequestedSymbols"": ""ABC,BCD,CDE"",
""RequestedFields"": ""ASK,BID,LAST"",
Source src = JsonConvert.DeserializeObject<Source>(json);
IMapper _mapper = _config.CreateMapper();
List<Destination> dests = _mapper.Map<Source, List<Destination>>(src);
Console.WriteLine(JsonConvert.SerializeObject(dests, new JsonSerializerSettings { Formatting = Formatting.Indented }));
public Request Request { get; set; }
public Error Error { get; set; }
public Records Records { get; set; }
public string Service { get; set; }
public List<Record> Record { get; set; }
public List<Field> Field { get; set; }
public string Id { get; set; }
public string Name { get; set; }
public string Value { get; set; }
public string RequestedSymbols { get; set; }
public string RequestedFields { get; set; }
public string Host { get; set; }
public string Id { get; set; }
public string Code { get; set; }
public string Description { get; set; }
public Fields Fields { get; set; }
public string Req_sym { get; set; }
public string Key { get; set; }
public string Stale { get; set; }
public string Symbol { get; set; }
public string ASK { get; set; }
public string BID { get; set; }
public string LAST { get; set; }
public class SourceToListDestinationTypeConverter : ITypeConverter<Source, List<Destination>>
public List<Destination> Convert(Source source, List<Destination> destination, ResolutionContext context)
List<Destination> result = new List<Destination>();
foreach (var record in source.Records.Record)
Dictionary<string, object> fieldDict = record.Fields.Field
.ToDictionary(x => x.Name, x => (object)x.Value);
fieldDict.Add(nameof(Destination.Symbol), record.Req_sym);
result.Add(context.Mapper.Map<Destination>(fieldDict));