I am trying to interact with an ASP.NET MVC controller action using a ServiceStack JsonServiceClient. The default serialization behavior of DateTime objects does not seem to be compatible with what MVC supports, is there any way to alter client's DateTime serialization behavior?
Asked
Active
Viewed 681 times
2 Answers
2
I believe the ServiceStack DateTime serialization can be controlled by setting the ServiceStack.Text.JsConfig.DateHandler
property.

AlexD
- 5,011
- 2
- 23
- 34
1
is there any way to alter client's DateTime serialization behavior?
In ASP.NET MVC there are 2 aspects: model binding JSON requests and sending JSON responses. Both use the built-in .NET JavaScriptSerializer
.
In order to alter the model binder you could write a custom ValueProviderFactory
.
For response JSON objects you could write a custom ActionResult instead of using the built-in Json method as shown in this thread
.
If you want to alter the behavior on the client then you could use what @AlexD suggested in his answer.

Community
- 1
- 1

Darin Dimitrov
- 1,023,142
- 271
- 3,287
- 2,928