jie566

asp.net core3.x 新增的序列号接口System.Text.Json

序列化时,如果要对所有 JSON 属性名称使用 camel 大小写

将 JsonSerializerOptions.PropertyNamingPolicy 设置为 JsonNamingPolicy.CamelCase即可

 例:

1 var serializeOptions = new JsonSerializerOptions
2 {
3     PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
4     WriteIndented = true
5 };
6 jsonString = JsonSerializer.Serialize(weatherForecast, serializeOptions);
View Code

 

分类:

技术点:

相关文章:

  • 2022-02-16
  • 2022-02-16
  • 2021-07-08
  • 2018-06-01
  • 2021-10-25
  • 2021-12-04
  • 2021-12-28
猜你喜欢
  • 2021-11-18
  • 2021-07-13
  • 2021-04-05
  • 2021-11-10
  • 2021-12-02
  • 2022-02-01
  • 2021-05-22
相关资源
相似解决方案