✅ How do I add a JsonConverter subclass to a .NET 7 WebApplication?
I've written a couple of custom JsonConverter classes, and I've been able to get them in place for manual Json serialization/deserialization. However, I haven't managed to get them to be applied when using a Web Application and a class with the
[ApiController]
attribute.
I'm currently setting it up like this:
where RegisterCustomConverters()
is:
However, RegisterConverters()
is never called, and when I sent a post request, it isn't deserialized using the custom converter.
Any idea what I'm doing wrong here?
Thanks1 Reply
Ah, I appear to have fixed it by changing it to: