I have the following class:
public class PropoertyValue {
string Id {get;set;}
object Value {get;set;}
string Type {get;set;}
}
When I serialize/deserialize Json I want the value property reflects the type specified in "Type" property. How can I do this?
Here Sample:
Json: {"Id":"Property1","Value":0,"Type":"System.Int32"}
// The Type must by any POCO object type.
When Deserialized I would call a PropertyValue class method that return the value:
public getValue<T>() => (T)Value;
Can anyone help me with serialization/deserialization of the PropertyValue type?