I'm trying to understand what is happening here. I am deserializing a JSON response with NewtonSoft.Json
I notice that I explicitly need to cast the properties of this dynamic type in order for them to be interpreted.
Example:
[Test]
public void Test()
{
var a = JsonConvert.DeserializeObject<dynamic>("{ 'Amount': '123.0' }");
Assert.AreEqual((decimal?)a.Amount, 123m); //PASS
Assert.AreEqual(a.Amount, 123m); //FAIL
}
I'm interested to understand why this is happening?
Regards