How can I find the source of this problem, where a date value serialized by JavaScriptSerializer cannot be deserialized by 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 a String was not recognized as a valid DateTime
exception.
If a date is serialized by JavaScriptSerializer then why can it not be deserialized by JavaScriptSerializer?