I have a class that inherits from Dictionary and has a couple of properties on it. When I serialize it only serializes the dictionary and not the properties. If I have a payload that includes the properties it does deserialize to them. How can I make it serialize my object including the properties?
public class Maintenance : Dictionary<string, dynamic>
{
public int PersonId { get; set; }
}
return JsonConvert.DeserializeObject<T>(jsonString); //Populates PersonId and all other properties end up in the dictionary.
return JsonConvert.SerializeObject(maintenance); //Only returns dictionary contents
I'd appreciate suggestions on how to make serialization use the same behavior as deserialization seems to use.