asp.net core 3.0 MVC JSON 全局配置

2019-12-20| 发布者: admin| 查看: |

install-package microsoft.aspnetcore.mvc.newtonsoftjson -version 3.1.0 startup装备代码如下:
ag平台总代using newtonsoft.json;
using newtonsoft.json.serialization;
public void configureservices
 services.addnewtonsoftjson;
 //数据格式按原样输出
 options.serializersettings.contractresolver = new defaultcontractresolver;
 //疏忽空值
 options.serializersettings.nullvaluehandling = nullvaluehandling.ignore;
}