I have json that has a date like 2012-06-07T00:29:47.000
and needs to be deserialized. But on
DataContractJsonSerializer serializer = new DataContractJsonSerializer(type); return (object)serializer.ReadObject(Util.GetMemoryStreamFromString(json));
I get below exception
There was an error deserializing the object of type System.Collections.Generic.List`1 [[MyNameSpace.MyClass, MyNameSpace, Version=1.0.4541.23433, Culture=neutral, PublicKeyToken=null]]. DateTime content '2012-06-07T00:29:47.000' does not start with '\/Date(' and end with ')\/' as required for JSON
It works on Windows Mobile 7 but the same code does not work on Windows 8.
The expected date format is \/Date(1337020200000+0530)\/
instead of 2012-06-07T00:29:47.000
.
Is custom serialization required, if so, how? And I can not use JSON.NET
I must use DataContractJsonSerializer
, and I can not change the JSON format, since the same JSON is used for android.
I am new to .net. Thanks.
source share