I'm trying to set serialization options for System.Text.Json in a top-level statements project. I'm doing something wrong in that the callback passed to Configure doesn't appear to be called. Can someone please set me in the right direction? Thanks
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.Mvc;
var builder = WebApplication.CreateSlimBuilder(args);
builder.Services.Configure<JsonOptions>(options =>
{
// This doesn't appear to be called.
options.JsonSerializerOptions.NumberHandling = JsonNumberHandling.AllowNamedFloatingPointLiterals;
});
var app = builder.Build();
app.MapGet("/", () => Results.Ok(new{value=double.PositiveInfinity}));
app.Run();