Closed GABowers closed 9 months ago
I just realized my mistake: My input variables to the class constructor need to be the same name as the properties. The following constructor allows things to pass:
public AgentProperty(string name, double initialValue, string formula)
{
Name = name;
InitialValue = initialValue;
Formula = formula;
}
I have a simple class that I use to do mathematical calculations. There's a string property that contains the initial formula. Unfortunately it does not get deserialized correctly in Json - the serialized string DOES contain the property but it disappears when deserializing.
Source/destination types
Source/destination JSON
Expected behavior
The deserialized object should have the same property values of the original object.
Actual behavior
The "Formula" string is parsed as a null in the Json deserializer (visible in the constructor of the class when attempting to deserialize).
Steps to reproduce