Working forum post
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@@ -42,8 +43,11 @@ namespace WebApi
|
||||
defaults: new { id = RouteParameter.Optional }
|
||||
);
|
||||
|
||||
// Dont include properties with null values
|
||||
config.Formatters.JsonFormatter.SerializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
|
||||
|
||||
// Force always json response
|
||||
var jsonFormatter = new JsonMediaTypeFormatter();
|
||||
//var jsonFormatter = new JsonMediaTypeFormatter();
|
||||
//optional: set serializer settings here
|
||||
//config.Services.Replace(typeof(IContentNegotiator), new JsonContentNegotiator(jsonFormatter));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user