Last active
March 8, 2020 02:22
-
-
Save Wind010/7fdeda553d05630696a83e1db86b4474 to your computer and use it in GitHub Desktop.
Enums serialized as strings for ASP.NET Core 3.1 using System.Text.Json.Serialization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text.Json.Serialization | |
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.AddControllers().AddJsonOptions(opts => | |
opts.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment