public class CustomJsonSerializerSettings : AbpMvcJsonOptions { public CustomJsonSerializerSettings() { JsonSerializerSettings.DefaultValueHandling = DefaultValueHandling.Include; JsonSerializerSettings.Formatting = Formatting.None; SerializerSettings.ContractResolver = new DefaultContractResolver(); SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; SerializerSettings.NullValueHandling = NullValueHandling.Ignore; } }
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc(options =>
{
options.OutputFormatters.Clear();
options.OutputFormatters.Insert(0, new NewtonsoftJsonOutputFormatter(
new CustomJsonSerializerSettings(), ArrayPool
这样就可以成功配置Abp Framework全局的JSON转换器了。
上一篇:ABPFramework4.4.3PackageIdentityServer44.1.1isnotcompatiblewithnet50onDeployment。
下一篇:AbpFramework缺少IRepository.AsNoTracking()方法(或无法使用Select、Where)