JsonContent.Create Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Create(Object, JsonTypeInfo, MediaTypeHeaderValue) |
Creates a new instance of the JsonContent class that will contain the |
| Create(Object, Type, MediaTypeHeaderValue, JsonSerializerOptions) |
Creates a new instance of the JsonContent class that will contain the |
| Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions) |
Creates a new instance of the JsonContent class that will contain the |
| Create<T>(T, JsonTypeInfo<T>, MediaTypeHeaderValue) |
Creates a new instance of the JsonContent class that will contain the |
Create(Object, JsonTypeInfo, MediaTypeHeaderValue)
- Source:
- JsonContent.cs
- Source:
- JsonContent.cs
- 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, 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
- 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.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
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);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
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);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member Create : obj * Type * System.Net.Http.Headers.MediaTypeHeaderValue * System.Text.Json.JsonSerializerOptions -> System.Net.Http.Json.JsonContent
static member Create : obj * Type * System.Net.Http.Headers.MediaTypeHeaderValue * System.Text.Json.JsonSerializerOptions -> System.Net.Http.Json.JsonContent
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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.
- Attributes
Applies to
Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)
- Source:
- JsonContent.cs
- Source:
- JsonContent.cs
- Source:
- JsonContent.cs
- 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.
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default, System.Text.Json.JsonSerializerOptions? options = default);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default, System.Text.Json.JsonSerializerOptions? options = default);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member Create : 'T * System.Net.Http.Headers.MediaTypeHeaderValue * System.Text.Json.JsonSerializerOptions -> System.Net.Http.Json.JsonContent
static member Create : 'T * System.Net.Http.Headers.MediaTypeHeaderValue * System.Text.Json.JsonSerializerOptions -> System.Net.Http.Json.JsonContent
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
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.
- Attributes
Applies to
Create<T>(T, JsonTypeInfo<T>, MediaTypeHeaderValue)
- Source:
- JsonContent.cs
- Source:
- JsonContent.cs
- 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.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.