how to get Json.net serialize DateTime similar to JavaScriptSerializer?
问题 My code base had been using JavaScriptSerializer for long time, now I am planning to migrate to Json.Net . I saw that DateTime Serializing on both work differently. Console.WriteLine(new JavaScriptSerializer().Serialize(DateTimeOffset.UtcNow)); Output:"\/Date(1403629024695)\/" Console.WriteLine(JsonConvert.SerializeObject(DateTimeOffset.UtcNow)); Output: "2014-06-24T16:57:04.6954145+00:00" Is there a way to get Json.net to serialize similar to JavaScriptSerializer? 回答1: You can use