C# 9 Record Type Not Preserving Default Values during JSON Serialization with System.Text.Json
I'm working on a personal project and I can't seem to get I'm working with an scenario while working with C# 9 record types and System.Text.Json for serialization. I have a record defined as follows: ```csharp public record User(string Name, int Age = 25); ``` When I serialize an instance of this record using `JsonSerializer`, I expect the default value for `Age` to be included in the JSON output if it isn't explicitly set. However, it seems that default values are not being preserved during serialization. Here's the code I'm using to serialize: ```csharp var user = new User("Alice"); var json = JsonSerializer.Serialize(user); Console.WriteLine(json); ``` The output I receive is: ``` {"Name":"Alice"} ``` As you can see, the `Age` property is missing from the JSON. I have tried changing the serialization options and using `[JsonInclude]` attribute, but nothing seems to work. I also checked the documentation and it mentions that default values should be serialized, but I suspect it might be related to how records are treated in C# 9. Is there a way to ensure that default values are included during serialization? I'm using .NET 5.0 and System.Text.Json version 5.0.2. Any insights or workarounds would be greatly appreciated! This is part of a larger web app I'm building. I'd really appreciate any guidance on this. Any ideas how to fix this? What are your experiences with this?