• 00
  • :
  • 00
  • :
  • 00

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

使用NewtonsoftJson

安装 Microsoft.AspNetCore.Mvc.NewtonsoftJson

 

 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";
                        });

 

posted @ 2020-06-03 13:07  Garson_Zhang  阅读(815)  评论(0编辑  收藏  举报