✅ How is JsonConverter(typeof(JsonStringEnumConverter<MyEnum>)) evaluated?
Hello,
This makes it possible that enum is serialized to string when the request comes in.
Is this evaluated on each request, or only once at compile time?
4 Replies
happens at runtime, but if using source generation with STJ, it will, as the name implies, source generate the actual glue-code to call the converter
there is one problem with that, I configured the source generation after the docs.
But now the serialization only works with those classes, any other DTO, even the ones not using enums will throw an exteption. This means that for every new DTO 2 more classes must be added to the serializer, this is really inconvenient.
Or I might be doing something wrong
Program.cs
I think this way the default serializer gets overridden, is there a way I could specify the default
JsonTypeInfoResolver
for the Combine()
method?
This seemed to work
could you try appending to the chain instead?
options.TypeInfoResolverChain.Add(YourSerializer.Default);
seems cleaner to meThis guy serializes 😄
Thank you so much