How to use class fields with System.Text.Json.JsonSerializer?
In .NET Core 3.x, System.Text.Json does not serialize fields. From the docs: Fields are not supported in System.Text.Json in .NET Core 3.1. Custom converters can provide this functionality. In .NET 5 and later, public fields can be serialized by setting JsonSerializerOptions.IncludeFields to true or by marking the field to serialize with [JsonInclude]: using System.Text.Json; static … Read more