Using Automapper to map from dynamic/JObject to arbitrary types without creating multiple maps Using Automapper to map from dynamic/JObject to arbitrary types without creating multiple maps json json

Using Automapper to map from dynamic/JObject to arbitrary types without creating multiple maps


The problem is that JObject wraps its content in JValue, so it cannot work by default with AM which of course expects the actual values. So you have to let AM know how to map a JValue:

cfg.CreateMap<JValue, object>().ConvertUsing(source => source.Value);