Example of JsonSerializerSettings

  1. public class Log  
  2. {  
  3.     public string Details  
  4.     {  
  5.         get;  
  6.         set;  
  7.     }  
  8.     public DateTime LogDate  
  9.     {  
  10.         get;  
  11.         set;  
  12.     }  
  13. }  
  14. Log log = new Log  
  15. {  
  16.     LogDate = new DateTime.Now,  
  17.         Details = "Application started."  
  18. };  
  19. JsonSerializerSettings microsoftDateFormatSettings = new JsonSerializerSettings  
  20. {  
  21.     DateFormatHandling = DateFormatHandling.MicrosoftDateFormat  
  22. };  
  23. string microsoftJson = JsonConvert.SerializeObject(log, microsoftDateFormatSettings);  
Result:
  1. // {"Details":"Application started.","LogDate":"\/Date(1234656000000)\/"}