Skip to content

.NET 7 update required: JSON options configuration #26445

@Rick-Anderson

Description

@Rick-Anderson

JSON options configuration

ConfigureRouteHandlerJsonOptions has been renamed ConfigureHttpJsonOptions, see dotnet/aspnetcore#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();

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions