I'm trying to set the global serializer settings like this in my global.asax
.
var formatter = GlobalConfiguration.Configuration.Formatters.JsonFormatter;
formatter.SerializerSettings = new JsonSerializerSettings
{
Formatting = Formatting.Indented,
TypeNameHandling = TypeNameHandling.Objects,
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
使用以下代码序列化对象时,不使用全局序列化程序设置吗?
return new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new StringContent(JsonConvert.SerializeObject(page))
};
Isn't it possible to set the global serializer settings like this or am I missing something?