If you don’t know what the JSON source generator is, I suggest to first check this older post before you continue reading. Still there? OK! Today I want to focus on some improvements in the JSON source generator that were introduced with the release of .NET 8.
Although the JSON source generator is a great (performance) improvement, it couldn’t handle some of the more recent language features like required members and init-only properties. If you tried to use these features in combination with source generators you get the following warning before .NET 8:
Starting from .NET, full support for required
and init
members has been added and the code above will just work: