AspNetCore.Docs
AspNetCore.Docs copied to clipboard
.NET 7 update required: JSON options configuration
ConfigureRouteHandlerJsonOptions has been renamed ConfigureHttpJsonOptions, see https://github.com/dotnet/aspnetcore/pull/42747
Need to update the following code for next release:
using System.Text.Json.Serialization;
var builder = WebApplication.CreateBuilder(args);
builder.Services.ConfigureRouteHandlerJsonOptions(options =>
{
options.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
options.SerializerOptions.AllowTrailingCommas = true;
options.SerializerOptions.MaxDepth = 8;
});
var app = builder.Build();
app.MapGet("/", () => "Hello World!");
app.Run();