Overriding serialization of request object types
ServiceStack's fast serialization of requests and responses is at the center of how its clients and services interact. Sometimes, however, there might be a need to have your request objects structured differently on the server than the client. In this recipe, we will cover how this can be handled within the ServiceStack framework.
Getting ready
First, we'll need a project with ServiceStack references to be up and running. To do this, please see Creating a ServiceStack solution with VisualStudio and NuGet in Appendix A, Getting Started.
Although ServiceStack has a simple way of aliasing properties for a request object, sometimes there might be more control needed around how your request-and-response objects serialize and deserialize.
Note
In this recipe, we are looking at only JSON serialization; some of these concepts can be converted into the other formats ServiceStack supports, such as JSV and CSV.
How to do it…
So, in this example, we are migrating...