This week I learned that serializing and deserialzing the new structs included with .NET 6, DateOnly and TimeOnly, is not supported by System.Text.Json.JsonSerializer. You´ll need to write custom converters and include them in the settings. This an example implementation of these converters:
![](https://moethorstensen.no/content/images/2022/03/carbon--49--1.png)
You´ll then need to include them in the JsonSerializerOptions
![](https://moethorstensen.no/content/images/2022/03/carbon--51-.png)
Or you could mark the properties in your type with the JsonConverterAttribute:
![](https://moethorstensen.no/content/images/2022/03/carbon--50-.png)
Thanks for reading.