dotnet / dotnet/AspNetCore.Docs

Doesn't tell us how to replace JsonOutputFormatter with System.Text.Json alternatives to modify the outputted json for all responses

Open
#16,637 2 comments 0 reactions 0 assignees View on GitHub
doc-enhancement Security-PU Source - Docs.ms
Dominant language
C#
Stars
13.1k
Forks
24.6k
Avg merge
1d 3h
Merged PRs (30d)
97

Description

In the past you could inherit from JsonOutputFormatter and override the response. This was useful so that you could have a fully formatted body that wasn't just the json object (which has security issues) and add additional properties like errors etc. to the response.

I don't see anywhere in the documentation information on how you'd replicate this same behavior without having to customize every response on every endpoint.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 6ebcd752-af71-c483-eebb-0745bd04fb30
* Version Independent ID: 1f678d5d-230b-0ad0-c925-15b13081f553
* Content: [Format response data in ASP.NET Core Web API](https://docs.microsoft.com/en-us/aspnet/core/web-api/advanced/formatting?view=aspnetcore-3.1#feedback)
* Content Source: [aspnetcore/web-api/advanced/formatting.md](https://github.com/aspnet/AspNetCore.Docs/blob/master/aspnetcore/web-api/advanced/formatting.md)
* Product: **aspnet-core**
* Technology: **aspnetcore-webapi**
* GitHub Login: @ardalis
* Microsoft Alias: **riande**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.