相关疑难解决方法(0)

.NET 核心 3:JsonPropertyName 的序列化顺序 (System.Text.Json.Serialization)

在迁移到 .NET Core 3 时,我已从 Newtonsoft.Json 序列化切换到 System.Text.Json.Serialization。在我想继续使用 JsonPropertyName 属性的所有功能中。

Newtonsoft 版本允许对序列化属性进行排序

[JsonProperty(Order = 1)]
public bool Deleted { get; set; }

[JsonProperty(Order = 2)]
public DateTime DeletedDate { get; set; }
Run Code Online (Sandbox Code Playgroud)

有没有办法在 System.Text.Json.Serialization 中实现相同的目标?

c# migration json .net-core-3.0 system.text.json

12
推荐指数
2
解决办法
5634
查看次数

标签 统计

.net-core-3.0 ×1

c# ×1

json ×1

migration ×1

system.text.json ×1