4 ms·
If you're using a good framework like C# Web Api, you don't have to choose. Just implement them all by adding them to the pipeline and the framework will automa
by scarface74 10y ago
If you're using a good framework like C# Web Api, you don't have to choose. Just implement them all by adding them to the pipeline and the framework will automatically serialize/deserialize based on the accept header.
- mbesto 10y agoInteresting, do you have more details about this?
- scarface74 10y agoYou register your custom serializer at application startup... http://www.strathweb.com/2014/11/formatters-asp-net-mvc-6/ http://www.strathweb.com/2014/11/formatters-asp-net-mvc-6/ Your controller action looks like this: public List<Employee> Get() { ..... return employeeList; } Based on the serializers you have registered and the request Accept header, WebApi will serialize the list into JSON, XML, BSon (all built in) or a custom serializer that you add like Protocal Buffers http://www.infoworld.com/article/2982579/application-architecture/working-with-protocol-buffers-in-web-api.html http://www.infoworld.com/article/2982579/application-archite... Basically you can have all four registered and the client decides what it accepts.