Hi, I have a scenario where I need to deserialize json string, that can represent either a single object of a certain type or an array of objects of this type, and I don't know ahead of time what exactly it is going to be. If I knew that I wouldn't have
Right now the following line throws an exception if json represents an array of MyClass objects
MyClass result = JsonConvert.DeserializeObject<MyClass>(json);
And this line returns empty List if json represents a single object
List<MyClass> result = JsonConvert.DeserializeObject<List<MyClass>>(json);
How can I solve this problem?
Thanks in advance.