ContractResolver,带下划线的小写字母(蛇形属性名称)?

时间:2018-07-28 14:21:00

标签: c# asp.net-core json.net asp.net-core-mvc

//这是骆驼壳

    services.AddMvcCore()
        .AddJsonOptions(options =>
        {
            options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
        })

如何设置带下划线的小写字母?

{
  "just_like_this": "myvalue",
}

1 个答案:

答案 0 :(得分:4)

您可能希望将1SnakeCaseNamingStrategy一起使用

DefaultContractResolver

引用Snake case property names