Table of Contents

Class JsonContent

Namespace
Kampute.HttpClient.Json
Assembly
Kampute.HttpClient.Json.dll

Represents HTTP content based on JSON serialized from an object.

public sealed class JsonContent : HttpContent, IDisposable
Inheritance
JsonContent
Implements
Inherited Members
Extension Methods

Constructors

JsonContent(object)

Initializes a new instance of the JsonContent class.

public JsonContent(object content)

Parameters

content object

The object to be serialized into JSON format.

Exceptions

ArgumentNullException

Thrown if content is null.

Properties

Options

Gets or sets the JSON serialization options.

public JsonSerializerOptions? Options { get; set; }

Property Value

JsonSerializerOptions

The JSON serialization options, if any.

Methods

SerializeToStreamAsync(Stream, TransportContext)

protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)

Parameters

stream Stream
context TransportContext

Returns

Task

TryComputeLength(out long)

protected override bool TryComputeLength(out long length)

Parameters

length long

Returns

bool