JsonSerializationInputFormatter Class
Definition
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json
- Assemblies
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json.dll
This class handles deserialization of JSON to objects using JsonFormatter.
public class JsonSerializationInputFormatter : StreamInputFormatter<JsonFormatter, JsonFormatterOptions>, IInputFormatter, IApiRequestFormatMetadataProvider, IConfigurable<JsonFormatterOptions>
- Inheritance
-
objectJsonSerializationInputFormatter
- 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 JsonSerializationInputFormatterExample
{
public void Demonstrate()
{
var options = new JsonFormatterOptions();
var formatter = new JsonSerializationInputFormatter(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 |
|---|---|
| JsonSerializationInputFormatter(JsonFormatterOptions) | Initializes a new instance of the JsonSerializationInputFormatter class. |