I am writing an application in ASP.NET Core WebApi. Given the tools provided by the framework, what is the best mechanism to use in order to inspect and change object property values during serialization?
Specifically what I need to do is perform a translation on, for example, a string value for a particular property if it meets certain criteria (for my app I'm using custom annotations to mark properties that need to be acted upon).
I assumed a ContractResolver would do the trick, but it appears to only work on Types rather than the object instance itself.
Additionally, I don't want to manually call a serialization method for this. This needs to be part of the WebAPI processing pipeline so I assume gets placed within the AddJsonOptions within Startup.cs.