I have a problem with deresializing downloaded JSON string from API. I would like to deserialize it to the abstract class, so the type would be decided by runtime.
My code example:
JsonSerializerSettings settings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All };
JsonClasses myObj = (JsonClasses) JsonConvert.DeserializeObject(this.Response, settings);
For explanation, in this.Response I have JSON string. I used this way (TypeNameHandling) of dealing with deserialization based on another topic in StackOverflow, but it didn't work for me - maybe because the fact, that they at first did serialization of the object to string and after that the deserialization. I have some derived classes from abstract class JsonClasses. They have diferent "JSON structure". Is there any possibility to resolve this some not so much difficultr way?
Thanks for help!