json序列化添加字段过滤

This commit is contained in:
xxred
2019-03-29 16:25:44 +08:00
parent e78545b11a
commit 1f186cccd5
3 changed files with 89 additions and 1 deletions
+6 -1
View File
@@ -23,6 +23,7 @@ using Senparc.CO2NET.RegisterServices;
using Senparc.Weixin;
using Senparc.CO2NET.Cache;
using System.Configuration;
using COMCMS.Web.Configuration;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.Options;
@@ -73,7 +74,11 @@ namespace COMCMS.Web
//部分系统配置
services.Configure<SystemSetting>(Configuration.GetSection("SystemSetting"));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); ;
services
.AddMvc()
.SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
.AddJsonOptions(JsonOptionsConfig.ConfigJsonOptions);
//防止汉字被自动编码
services.Configure<WebEncoderOptions>(options =>
{