JsonContent.Create Method

Definition

Overloads

Create(Object, Type, MediaTypeHeaderValue, JsonSerializerOptions)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

Create(Object, Type, MediaTypeHeaderValue, JsonSerializerOptions)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

public static System.Net.Http.Json.JsonContent? Create (object inputValue, Type? inputType, System.Net.Http.Headers.MediaTypeHeaderValue mediaType = default, System.Text.Json.JsonSerializerOptions options = default);
static member Create : obj * Type * System.Net.Http.Headers.MediaTypeHeaderValue * System.Text.Json.JsonSerializerOptions -> System.Net.Http.Json.JsonContent
Public Shared Function Create (inputValue As Object, inputType As Type, Optional mediaType As MediaTypeHeaderValue = Nothing, Optional options As JsonSerializerOptions = Nothing) As JsonContent

Parameters

inputValue
Object

The value to serialize.

inputType
Type

The type of the value to serialize.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

options
JsonSerializerOptions

Options to control the behavior during serialization, the default options are Web.

Returns

JsonContent

A JsonContent instance.

Applies to

Product Introduced

Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

public static System.Net.Http.Json.JsonContent? Create<T> (T? inputValue, System.Net.Http.Headers.MediaTypeHeaderValue mediaType = default, System.Text.Json.JsonSerializerOptions options = default);
static member Create : 'T * System.Net.Http.Headers.MediaTypeHeaderValue * System.Text.Json.JsonSerializerOptions -> System.Net.Http.Json.JsonContent
Public Shared Function Create(Of T) (inputValue As T, Optional mediaType As MediaTypeHeaderValue = Nothing, Optional options As JsonSerializerOptions = Nothing) As JsonContent

Type Parameters

T

The type of the value to serialize.

Parameters

inputValue
T

The value to serialize.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

options
JsonSerializerOptions

Options to control the behavior during serialization, the default options are Web.

Returns

JsonContent

A JsonContent instance.

Applies to

Product Introduced