Example code
JToken json = JObject.Parse(
" {\"Url\": \"www.fakeUrl.com\",\"CallId\": 12}");
var poco = mapper.Map<CallData>(json);
Console.WriteLine(json);
Console.WriteLine(poco.Url + " " + poco.CallId);
Simple Model
public class CallData
{
public int CallId { get; set; }
public string Url { get; set; }
}
Output
{ "Url": "www.fakeUrl.com", "CallId": 12 }
www.fakeUrl.com 0
I'm just curious to why Automapper isn't mapping the integer in this JSON object? I know there are alternatives out such as a custom extension for this but I'm wondering why AutoMapper can't do this simple map?
Automapper V7.0.1
I resolved the issue by adding a custom mapping. I still believe this to be an issue with the underlining libraries and will investigate further as this simple primitive mapping shouldn't need extensions.
Mapper
Usage