7 Replies
Can you provide an example JSON structure you expect after serialization, including the attributes that should be included in the JSON?
sure,
in case of TestClass2 my logic would be
{
"ResolveToType ":"TestClass2"
"RandomString": "sss"
}
and when i de-serialize i want to get TestClass2 🙂 cuz i ISerilizableStateConverter JsonRead should use its ResolveToType for that
@glhays any magic solution incoming?
Something maybe like this.
will try ty you are god if this works 🙂
atm my soution with propertis gives me loop expection
this is not using using Newtonsoft.Json; ? does this work with using Newtonsoft.Json;?
Or does anyone know how to for for specific class to turn typehanding.object so i can serilize/deserlize classes that implement some abstract class
I think the easiest way if you have an abstract base is to have either an int or enum for representing the type id and doing something like this https://stackoverflow.com/questions/20995865/deserializing-json-to-abstract-class
Stack Overflow
Deserializing JSON to abstract class
I am trying to deserialize a JSON string to a concrete class, which inherits from an abstract class, but I just can't get it working. I have googled and tried some solutions but they don't seem to ...
Although I would recommend switching to System.Text.Json if you can
Hmm is there any way for jonSerializer when deserilize to call it whitout <T> and for it to know to use custom deserilizer