Well, I'm trying to serialize and save an object to JSON format and then deserialize the same object in C#. The object class is as follows:
public class NodeModel
{
public double X { get; set; }
public double Y { get; set; }
public int ParentNumber { get; set; }
public GeometryParams Geometry { get; set; }
public object Props { get; set; }
}
I cannot use concrete classes instead of the object for the type of Props since the type is different among different objects. When I Serialize the object, I use a derived type to fill Props property. The result is well-structured in the JSON file. But when I deserialize it, it returns null for Props property while other properties are deserialized successfully.
Thanks to the comment of Martin https://stackoverflow.com/users/1882699/martin-staufcik Changing the type of Props
to JObject
helped me get the value of Props
.