Working forum post

This commit is contained in:
2017-06-12 14:16:38 +03:00
parent aeb18aa75b
commit 4aadaf08fe
8 changed files with 75 additions and 22 deletions

View File

@@ -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));
}