I'm building a WCF service that also has an endpoint for JSON.
The problem is the DataContractSerializer default in WCF uses a standard I don't want to use. I looked into changing this, but I found no good way to do it. All threads and solutions I find for this are pretty old, 2012-2013. Is there a clean solution for this or have Microsoft made some changes to WCF to make this easier than writing your own DispatchMessageFormatter, etc.?
Note I'm not talking about the Web. This is a pure self-hosted WCF service.
I tried already implementing a DispatchMessageFormatter. It works, but it has some issues coming along with it, for example, all WebContentFormat has to be Raw
, etc.
This question specifically mentions the accepted answers in that question and asking for another way to do this now five years later without all of the negative side effects it brings.