JsonContent.Create Method

Definition

Overloads

Create(Object, JsonTypeInfo, MediaTypeHeaderValue)

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.

Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)

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

Create<T>(T, JsonTypeInfo<T>, MediaTypeHeaderValue)

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

Create(Object, JsonTypeInfo, MediaTypeHeaderValue)

Source:
JsonContent.cs
Source:
JsonContent.cs

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, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default);
static member Create : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo * System.Net.Http.Headers.MediaTypeHeaderValue -> System.Net.Http.Json.JsonContent
Public Shared Function Create (inputValue As Object, jsonTypeInfo As JsonTypeInfo, Optional mediaType As MediaTypeHeaderValue = Nothing) As JsonContent

Parameters

inputValue
Object

The value to serialize.

jsonTypeInfo
JsonTypeInfo

The JsonTypeInfo used to control the serialization behavior.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

Returns

A JsonContent instance.

Applies to

Create(Object, Type, MediaTypeHeaderValue, JsonSerializerOptions)

Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs

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

A JsonContent instance.

Applies to

Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)

Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs

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

A JsonContent instance.

Applies to

Create<T>(T, JsonTypeInfo<T>, MediaTypeHeaderValue)

Source:
JsonContent.cs
Source:
JsonContent.cs

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.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default);
static member Create : 'T * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T> * System.Net.Http.Headers.MediaTypeHeaderValue -> System.Net.Http.Json.JsonContent
Public Shared Function Create(Of T) (inputValue As T, jsonTypeInfo As JsonTypeInfo(Of T), Optional mediaType As MediaTypeHeaderValue = Nothing) As JsonContent

Type Parameters

T

The type of the value to serialize.

Parameters

inputValue
T

The value to serialize.

jsonTypeInfo
JsonTypeInfo<T>

The JsonTypeInfo used to control the serialization behavior.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

Returns

A JsonContent instance.

Applies to