SetConfig(new EndpointHostConfig {
UseBclJsonSerializers = true
});
Note: Even though the ServiceStack JsonSerializer supports serialization of late-bound (i.e. object) and anonymous types, I consider it an anti-pattern to define your DTOs using it.
You'll lose visibility and the ability to statically verify the external API of your web service (i.e. the most important interface/contract in your entire solution). Where you can only determine by inspecting the internal implementation of the web service implementation or inspecting the service by executing it at runtime. Either way you (and ServiceStack) will lose the intelligence about the contract of your API which means XSDs, WSDLs and auto-generated documentation pages are impossible to generate. Versioning/testing also becomes harder as you'll have no point-in-time idea of what requests existing clients are making and whether your changes will impact them.
I really need to write a blog post advising against this practice, as for some reason it seems like a popular approach (must be the recent cool attached to 'dynamic' keyword that seems to transcend best-practices web service development).
The relevant patterns to web services design include:
This best-practices advice which has stand the test of time is the inspiration behind ServiceStack and the development model it helps to promote.
Hope this explains things better.
Cheers,