【发布时间】:2018-08-30 04:55:37
【问题描述】:
我在 Startup 类中设置缩进 JSON,但是如何从控制器中检索格式化值?
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc()
.AddWebApiConventions()
.AddJsonOptions(options=> options.SerializerSettings.Formatting=Newtonsoft.Json.Formatting.Indented);
}
}
public class HomeController : Controller
{
public bool GetIsIndented()
{
bool isIndented = ????
return isIndented;
}
}
【问题讨论】:
标签: c# asp.net-core asp.net-core-2.0