I am working on ASP.NET MVC app that subscribes to webhook on launch, processes incoming JSONs and sends JSON-formatted responses. I find default serialization not suitable for my needs, because I need to tell the application which properties of my classes should be serialized and which names those properties are bound to (i.e. the property is InputFile
, but JSON property must be input_file
, etc.). I found that WCF's DataContracts are the easiest way to achieve this. The problem is that I am unsure if it is okay for my action to return EmptyResult
and send requests containing JSON in its body, so I am trying to replace the default serialization provider (which seems to be using JavascriptSerializer
class).
Asked
Active
Viewed 1,917 times
0

Eugene
- 41
- 3
-
Why do not you want to use https://www.newtonsoft.com/json There are attributes which allow to ignore properties to have names in the JSON file differ from the names in the model, ways to implement custom converters and many more things. Just take a look. – Antipod Feb 24 '18 at 15:26
-
But even if I'd want to use Newtonsoft, doesn't the question still apply? I have no idea how to replace the default serialization provider used in `Json()` function. – Eugene Feb 24 '18 at 15:29
-
Will it help https://stackoverflow.com/questions/23995210/how-to-use-json-net-for-json-modelbinding-in-an-mvc5-project – Antipod Feb 24 '18 at 15:40
-
With my incompetence all that mass of code looks so terrible I'd rather just send `HttpRequest` myself and return `EmptyResult` from my action. – Eugene Feb 24 '18 at 15:52