Tag Archives: JSON

Using JSON.Net to eval json into a dynamic variable in C#

So I thought this would be possible and finally decided to give it a shot in 2010 Beta 2. It turns a bunch of JSON into an ExpandoObject using JSON.Net. Needs cleaning up but not too bad.         [TestMethod]         public void DeserializeTestObjectToDynamic(){             TestObject testObject = new TestObject() {                 FirstName = “Peter”,                 [...]

6  

DataContractJsonSerializer and DateTime values

In using the DataContractJsonSerializer beware of DateTime instances which have been instantiated as non-UTC. If you declare without explicitly assigning a DateTime you get the same as default(DateTime), this is 01/01/01 00:00:00 (0 ticks) with a DateTimeKind of Unspecified. When the DataContractJsonSerializer looks at this value (or a Local datetime), it will try to convert [...]

1