Guest User

Untitled

a guest
Jan 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. var serializerSettings = new JsonSerializerSettings
  2. {
  3. DateFormatHandling = DateFormatHandling.IsoDateFormat,
  4. DateTimeZoneHandling = DateTimeZoneHandling.Utc
  5. };
  6.  
  7. serializerSettings.Converters.Add(new IsoDateTimeConverter());
  8.  
  9. var jsonFormatter = new JsonMediaTypeFormatter { SerializerSettings = serializerSettings };
  10. jsonFormatter.MediaTypeMappings.Add(GlobalConfiguration.Configuration.Formatters[0].MediaTypeMappings[0]);
  11.  
  12. GlobalConfiguration.Configuration.Formatters[0] = jsonFormatter;
  13.  
  14. WebApiConfig.Register(GlobalConfiguration.Configuration);
Add Comment
Please, Sign In to add comment