Available starting with v1.9.0
Enabling output formatters support is a matter of:
builder.Services.AddViewModelComposition(options =>
{
options.ResponseSerialization.UseOutputFormatters = true;
});
builder.Services.AddControllers();
The required steps are:
UseOutputFormatters to trueAddControllers()AddControllersAndViews()AddMvc()AddRazorPages()The above configuration uses the new System.Text.Json serializer as the default json serializer to format json responses. It’s possible to plug-in the Newtonsoft Json.Net serializer output formatter by adding a package reference to the Microsoft.AspNetCore.Mvc.NewtonsoftJson package, and using the following configuration:
builder.Services.AddViewModelComposition(options =>
{
options.ResponseSerialization.UseOutputFormatters = true;
});
builder.Services.AddControllers()
.AddNewtonsoftJson();