Codebelt.Extensions.Carter.AspNetCore.Text.Json
1.0.0
dotnet add package Codebelt.Extensions.Carter.AspNetCore.Text.Json --version 1.0.0
NuGet\Install-Package Codebelt.Extensions.Carter.AspNetCore.Text.Json -Version 1.0.0
<PackageReference Include="Codebelt.Extensions.Carter.AspNetCore.Text.Json" Version="1.0.0" />
<PackageVersion Include="Codebelt.Extensions.Carter.AspNetCore.Text.Json" Version="1.0.0" />
<PackageReference Include="Codebelt.Extensions.Carter.AspNetCore.Text.Json" />
paket add Codebelt.Extensions.Carter.AspNetCore.Text.Json --version 1.0.0
#r "nuget: Codebelt.Extensions.Carter.AspNetCore.Text.Json, 1.0.0"
#:package Codebelt.Extensions.Carter.AspNetCore.Text.Json@1.0.0
#addin nuget:?package=Codebelt.Extensions.Carter.AspNetCore.Text.Json&version=1.0.0
#tool nuget:?package=Codebelt.Extensions.Carter.AspNetCore.Text.Json&version=1.0.0
Codebelt.Extensions.Carter.AspNetCore.Text.Json
A System.Text.Json-powered response negotiator for Carter in ASP.NET Core minimal APIs.
About
Codebelt.Extensions.Carter.AspNetCore.Text.Json extends the Codebelt.Extensions.Carter package with a dedicated JSON response negotiator for Carter, capable of serializing response models to JSON format using System.Text.Json.
Use this package when you want a lightweight, built-in JSON stack with Carter response negotiation and configurable serializer options.
CSharp Example
Functional-test style sample (same bootstrapping pattern used by this repository):
using System.Net.Http.Headers;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using Carter;
using Codebelt.Extensions.Carter.AspNetCore.Text.Json;
using Codebelt.Extensions.Carter.Assets;
using Codebelt.Extensions.Xunit.Hosting.AspNetCore;
using Cuemon.Extensions.AspNetCore.Text.Json;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using var response = await MinimalWebHostTestFactory.RunAsync(
services =>
{
services.AddMinimalJsonOptions(o =>
{
o.Settings.Converters.Insert(0, new JsonStringEnumConverter());
});
services.AddCarter(configurator: c => c
.WithModule<WorldModule>()
.WithResponseNegotiator<JsonResponseNegotiator>());
services.AddRouting();
},
app =>
{
app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapCarter());
},
_ => { },
async client =>
{
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
return await client.GetAsync("/world/statistical-regions");
});
Program-style usage for production apps (remember to inherit from ICarterModule for your endpoints and add other services as needed):
using Carter;
using Codebelt.Extensions.Carter.AspNetCore.Text.Json;
using Cuemon.Extensions.AspNetCore.Text.Json;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddMinimalJsonOptions();
builder.Services.AddCarter(c => c
.WithResponseNegotiator<JsonResponseNegotiator>());
var app = builder.Build();
app.MapCarter();
app.Run();
Related Packages
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Codebelt.Extensions.Carter (>= 1.0.0)
- Cuemon.Extensions.AspNetCore.Text.Json (>= 10.4.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 72 | 3/1/2026 |
Version: 1.0.0
Availability: .NET 10
# New Features
- ADDED JsonResponseNegotiator class in the Codebelt.Extensions.Carter.AspNetCore.Text.Json namespace that provides a JSON response negotiator for Carter, capable of serializing response models to JSON format using System.Text.Json