JsonSerializationOutputFormatter Class
Definition
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json
- Assemblies
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.dll
This class handles serialization of objects to JSON using JsonFormatter.
public class JsonSerializationOutputFormatter : StreamOutputFormatter<JsonFormatter, JsonFormatterOptions>, IOutputFormatter, IApiResponseTypeMetadataProvider, IConfigurable<JsonFormatterOptions>
- Inheritance
-
JsonSerializationOutputFormatter
- Implements
- Inherited Members
- Extension Methods
Examples
The following example demonstrates how to construct a and inspect its supported media types and encodings.
using System;
using System.Linq;
using Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json;
using Cuemon.Extensions.Text.Json.Formatters;
namespace DocfxExamples;
public class JsonSerializationOutputFormatterExample
{
public void Demonstrate()
{
var options = new JsonFormatterOptions();
var formatter = new JsonSerializationOutputFormatter(options);
Console.WriteLine($"Supported media types: {string.Join(", ", formatter.SupportedMediaTypes)}");
Console.WriteLine($"Supported encodings: {string.Join(", ", formatter.SupportedEncodings.Select(e => e.WebName))}");
}
}
Constructors
| Name | Description |
|---|---|
| JsonSerializationOutputFormatter(JsonFormatterOptions) | Initializes a new instance of the JsonSerializationOutputFormatter class. |