ABP vNext的JSON返回结果大小写问题

时间:2025-02-16 12:45:37

ABP vNext的JSON返回结果大小写问题

问题描述:ABP vNext Core版本的API会把JSON返回结果中Dto类的属性第一个字母小写(Camal)。

ABP返回结果属性大小写问题,JsonResult返回结果首字母被小写,如何改成原样输出JSON结果集。

解决方案:在web项目的xxxxxModule模块配置中

public override void ConfigureServices(ServiceConfigurationContext context)
{

    <MvcNewtonsoftJsonOptions>(options => {
                = new ();
                = "yyyy-MM-dd HH:mm:ss";
            });

}

适用于ABP的2.7版本以上。/

 

abp vnext 4.2.1版本需要增加如下:

If you want to continue to use the library for all the types, you can set UseHybridSerializer to false in the PreConfigureServices method of your module class:

PreConfigure<AbpJsonOptions>(options =>
{
     = false;
});