If I have a dictionary and add e.g. an instance of a class MyClass to this dictionary, how do I make sure that a deserialization and serialization of the dictionary contains the class and not a JObject?
internal class MyClass
{
    public string MyProperty { get; set; }
}
[TestMethod]
public async Task DebugTest()
{
        Dictionary<string, object> testDictionary = new Dictionary<string, object>();
        testDictionary.Add("testkey", new MyClass() { MyProperty = "testproperty" });
        string json = JsonConvert.SerializeObject(testDictionary);
        Dictionary<string, object> restoredDictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
    }
The testDictionary contains the MyClass, but the restoredDictionary contains a JObject.
Update: Please note that I will have to use string, object. So I'm really looking for a way to tell Json.Net to convert to a class and not JObject
var restoredDictionary = JsonConvert.DeserializeObject<Dictionary<string, MyClass>>(json);Dictionary<string, MyClass>..Why you want to use object ?