Answer the question
In order to leave comments, you need to log in
JSON serialization library that supports inheritance?
Good day. What can be done to (de)serialize such classes?
public class DataA
{
public Int32 Value;
}
public class DataB : DataA
{
public Double Value2;
}
Answer the question
In order to leave comments, you need to log in
Json.net supports inheritance, moreover, it can even correctly convert DataA to DataB if before that there was a cast to the base type (DataA b = new DataB and b was stored in json and then you need to get DataB b2 = Json.Deserialize<>( jsonString) ). The whole trick is in the TypeNameHandling setting.
stackoverflow.com/questions/8513042/json-net-seria...
www.newtonsoft.com/json/help/html/serializetypenam...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question