Quantcast
Channel: Json.NET
Viewing all articles
Browse latest Browse all 1767

Created Issue: Exception while deserializing DateTime in version 5 [24215]

$
0
0
We used Json.NET 4 to serialize Dictionary<DateTime, string> and save it to database.

Now we updated NuGet package to the version 5 and now the software throws an exception:

```
// from database
var myjson = "{\"03/27/2013 02:51:38\":\"customer note\"}";

JsonConvert.DeserializeObject<Dictionary<DateTime, string>>(myjson);

Throws exception:

Could not convert string '03/27/2013 02:51:38' to dictionary key type 'System.DateTime'. Create a TypeConverter to convert from the string to the key type object. Path '03/27/2013 02:51:38', line 1, position 23.
```

Viewing all articles
Browse latest Browse all 1767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>