The. NET JSON serializer, JavaScriptSerializer and DataContractJsonSerializer, are serialized into Microsoft's datetime JSON format, e.g. "\/date ( 1198908717056) \ "
If you change the JSON serializer to json.net, you may encounter problems with serializing the DateTime format.
The behavior of json.net is like this.
<=4.5, also serialized into Microsoft's datetime JSON format, e.g. "\/date (1198908717056+0800) \ \".
>4.5, serialized into ISO Standard time format, "2016-05-05t14:59:30.4617225+08:00"
If you want to make Json.NET (>4.5) default also output to Microsoft's datetime JSON format solution as follows:
var settings = new Jsonserializersettings ();
Settings. Dateformathandling = dateformathandling.microsoftdateformat;//compatible with <=4.5 version, default serialization to Microsoft's datetime JSON format, e.g. "\/date ( 1198908717056+0800)/", if you want to output ISO standard time, you can set it through DateTimeFormat.
Code such as.
How datetime is processed when JSON is serialized