Class JsonSerializationInputFormatter
- Namespace
- Cuemon.Extensions.AspNetCore.Mvc.Formatters.Text.Json
- Assembly
- 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
-
JsonSerializationInputFormatter
- 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
JsonSerializationInputFormatter(JsonFormatterOptions)
Initializes a new instance of the JsonSerializationInputFormatter class.
public JsonSerializationInputFormatter(JsonFormatterOptions options)
Parameters
optionsJsonFormatterOptionsThe JsonFormatterOptions which need to be configured.