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

Posted GarsonZhang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了.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";
                        });

 

以上是关于.net core post自带的json序列化转换出错 post参数为null的主要内容,如果未能解决你的问题,请参考以下文章