Closed ZijianFLG closed 3 months ago
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft#jsonobjectattribute Newtonsoft.Json has an attribute, JsonObjectAttribute, that can be applied at the type level to control which members are serialized, how null values are handled, and whether all members are required. System.Text.Json has no equivalent attribute that can be applied on a type.
Therefore, DateContractAttribute still shine for cheery picking.
Or, use assembly cheery picking, that is, put those classes that needs to be exposed to client apps into a data model assembly. Good for decoupling / "separation of concerns" / service loading anyway.
Ready to release: JsonPropertyNameAttribute JsonIgnoreAttribute JsonRequiredAttribute
https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonpropertynameattribute https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/migrate-from-newtonsoft