Serialization of Nullable<AnnualDate> with System.Text.Json
dgarciarubio opened this issue · comments
Daniel García Rubio commented
Using the preview of System.Text.Json serialization, and Asp.Net Core 3.1, I'm getting a default serialization for nullable AnnualDate values when they are not null:
{
"annualDate": {
"month": 1,
"day": 1
},
"nullableAnnualDateWithValue": {
"hasValue": true,
"value": {
"month": 1,
"day": 1
}
},
"nullableAnnualDateWithoutValue": null
}
This is different to other composite values such as Interval, which serializes as follows:
{
"interval": {
"start": "1970-01-01T00:00:00Z",
"end": "1970-01-01T00:00:00Z"
},
"nullableIntervalWithValue": {
"start": "1970-01-01T00:00:00Z",
"end": "1970-01-01T00:00:00Z"
},
"nullableIntervalWithoutValue": null
}
Is there any issue preventing the AnnualDate struct being serialized like the others?
Jon Skeet commented
On mobile so can't check right now, but my guess is that we don't have an AnnualDate serializer.