3 ms·
You register your custom serializer at application startup... http://www.strathweb.com/2014/11/formatters-asp-net-mvc-6/ http://www.strathweb.com/2014/11/forma
by scarface74 10y ago
You 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.