The test that I'm running simply takes a .net object serializes it to a json string. I then take that string and attempt to deserialize it back into a .net object. The string that is being serialized looks good, but for some reason, deserialization is failing on two properties, an int and a DateTime
These are the .net properties being used:
public string TokenString { get; set; }
public TokenUsage TokenUsage { get; set; }
public string TokenType { get; set; }
public string UserId { get; set; }
public DateTime Expires { get; private set; }
public int ExpiresIn { get; private set; }
And this is the json that is being serialized:
{
"TokenString":"encryptedtoken",
"TokenUsage":300,
"TokenType":"Bearer",
"UserId":"myId",
"Expires":"2013-07-05T11:28:18.4179133Z",
"ExpiresIn":3600,
"IsExpired":false
}
And here's the inspector, following deserialization of that very string:
As you can see, most everything is good. Token usage (an enum) seems to have even deserialized correctly. I'm not doing anything fancy in the serialize/deserialize area. Just JsonConvert.Serialize(myObject)
and JsonConvert.Deserialize<MyObject>(jsonString)
Any ideas?