How can I find the source of this problem where the date value serialized by the JavaScriptSerializer cannot be deserialized using the JavaScriptSerializer?
In the calling application:
var serializer = new JavaScriptSerializer(); var json = serializer.Serialize(model); // generates this json {'Guid':'guid','OrderNumber':'1','OrderDate':'\/Date(1299456000000)\/', 'OrderStatus':'Completed','DiscountRate':0.0000}
In the receiving application:
string json = @"{'Guid':'guid','OrderNumber':'1','OrderDate':'\/Date(1299456000000)\/', 'OrderStatus':'Completed','DiscountRate':0.0000}"; var serializer = new JavaScriptSerializer(); var model = serializer.Deserialize(json);
Throws an exception String was not recognized as a valid DateTime .
If a date is serialized by a JavaScriptSerializer, then why can't it be deserialized by a JavaScriptSerializer?
source share