Class NewtonsoftJsonNegotiator
- Namespace
- Codebelt.Extensions.Carter.AspNetCore.Newtonsoft.Json
- Assembly
- Codebelt.Extensions.Carter.AspNetCore.Newtonsoft.Json.dll
Provides a JSON response negotiator for Carter, capable of serializing response models to JSON format using Newtonsoft.Json.
public class NewtonsoftJsonNegotiator : ConfigurableResponseNegotiator<NewtonsoftJsonFormatterOptions>, IConfigurable<NewtonsoftJsonFormatterOptions>, IResponseNegotiator
- Inheritance
-
NewtonsoftJsonNegotiator
- Implements
- Inherited Members
Constructors
NewtonsoftJsonNegotiator(IOptions<NewtonsoftJsonFormatterOptions>)
Initializes a new instance of the NewtonsoftJsonNegotiator class.
public NewtonsoftJsonNegotiator(IOptions<NewtonsoftJsonFormatterOptions> options)
Parameters
optionsIOptions<NewtonsoftJsonFormatterOptions>The NewtonsoftJsonFormatterOptions used to configure JSON serialization and supported media types.
Methods
GetDefaultEncoding()
Returns UTF-8 without a byte-order mark (BOM) as the default character encoding for this negotiator.
protected override Encoding GetDefaultEncoding()
Returns
- Encoding
A UTF8Encoding instance with the byte-order mark disabled.
GetFormatter()
Returns a new NewtonsoftJsonFormatter configured with the current NewtonsoftJsonFormatterOptions.
public override StreamFormatter<NewtonsoftJsonFormatterOptions> GetFormatter()
Returns
- StreamFormatter<NewtonsoftJsonFormatterOptions>
A NewtonsoftJsonFormatter instance configured with the current NewtonsoftJsonFormatterOptions.
See Also
ConfigurableResponseNegotiator<TOptions>