使用NewtonsoftJson

安装 Microsoft.AspNetCore.Mvc.NewtonsoftJson

.net core post自带的json序列化转换出错 post参数为null

 

 Startup.ConfigureServices配置

            //配置Mvc + json 序列化
            services.AddMvc(options => { options.EnableEndpointRouting = false; })
                    .SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
                        .AddNewtonsoftJson(options =>
                        {
                            options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
                            options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm";
                        });

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2021-12-14
  • 2021-04-08
  • 2021-07-27
  • 2021-07-27
  • 2021-12-16
  • 2022-12-23
相关资源
相似解决方案