JsonTypeInfo.CreateJsonTypeInfo 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
| Name | Description |
|---|---|
| CreateJsonTypeInfo(Type, JsonSerializerOptions) |
Creates a blank JsonTypeInfo instance. |
| CreateJsonTypeInfo<T>(JsonSerializerOptions) |
Creates a blank JsonTypeInfo<T> instance. |
CreateJsonTypeInfo(Type, JsonSerializerOptions)
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
Creates a blank JsonTypeInfo instance.
public:
static System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ CreateJsonTypeInfo(Type ^ type, System::Text::Json::JsonSerializerOptions ^ options);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateJsonTypeInfo(Type type, System.Text.Json.JsonSerializerOptions options);
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo CreateJsonTypeInfo(Type type, System.Text.Json.JsonSerializerOptions options);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
static member CreateJsonTypeInfo : Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Serialization.Metadata.JsonTypeInfo
static member CreateJsonTypeInfo : Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.Serialization.Metadata.JsonTypeInfo
Public Shared Function CreateJsonTypeInfo (type As Type, options As JsonSerializerOptions) As JsonTypeInfo
Parameters
- type
- Type
The type for which contract metadata is specified.
- options
- JsonSerializerOptions
The JsonSerializerOptions instance the metadata is associated with.
Returns
A blank JsonTypeInfo instance.
- Attributes
Exceptions
type or options is null.
type cannot be used for serialization.
Remarks
The returned JsonTypeInfo will be blank, with the exception of the Converter property which will be resolved either from Converters or the built-in converters for the type. Any converters specified via JsonConverterAttribute on the type declaration will not be resolved by this method.
Which converter gets resolved influences the value of Kind, which constrains the type of metadata that can be modified in the JsonTypeInfo instance.
Applies to
CreateJsonTypeInfo<T>(JsonSerializerOptions)
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
- Source:
- JsonTypeInfo.cs
Creates a blank JsonTypeInfo<T> instance.
public:
generic <typename T>
static System::Text::Json::Serialization::Metadata::JsonTypeInfo<T> ^ CreateJsonTypeInfo(System::Text::Json::JsonSerializerOptions ^ options);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> CreateJsonTypeInfo<T>(System.Text.Json.JsonSerializerOptions options);
public static System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> CreateJsonTypeInfo<T>(System.Text.Json.JsonSerializerOptions options);
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")>]
static member CreateJsonTypeInfo : System.Text.Json.JsonSerializerOptions -> System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T>
static member CreateJsonTypeInfo : System.Text.Json.JsonSerializerOptions -> System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T>
Public Shared Function CreateJsonTypeInfo(Of T) (options As JsonSerializerOptions) As JsonTypeInfo(Of T)
Type Parameters
- T
The type for which contract metadata is specified.
Parameters
- options
- JsonSerializerOptions
The JsonSerializerOptions instance the metadata is associated with.
Returns
A blank JsonTypeInfo<T> instance.
- Attributes
Exceptions
options is null.
Remarks
The returned <see cref="T:System.Text.Json.Serialization.Metadata.JsonTypeInfo`1> will be blank, with the exception of the Converter property, which will be resolved either from Converters or the built-in converters for the type. Any converters specified via JsonConverterAttribute on the type declaration will not be resolved by this method.
Which converter gets resolved influences the value of Kind, which constrains the type of metadata that can be modified in the JsonTypeInfo instance.