JsonSerializer.SerializeToDocument Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Перегрузки
| Имя | Описание |
|---|---|
| SerializeToDocument(Object, JsonTypeInfo) |
Преобразует предоставленное значение в JsonDocumentобъект. |
| SerializeToDocument(Object, Type, JsonSerializerOptions) |
Преобразует предоставленное значение в JsonDocumentобъект. |
| SerializeToDocument(Object, Type, JsonSerializerContext) |
Преобразует предоставленное значение в JsonDocumentобъект. |
| SerializeToDocument<TValue>(TValue, JsonSerializerOptions) |
Преобразует предоставленное значение в JsonDocumentобъект. |
| SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>) |
Преобразует предоставленное значение в JsonDocumentобъект. |
SerializeToDocument(Object, JsonTypeInfo)
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
Преобразует предоставленное значение в JsonDocumentобъект.
public:
static System::Text::Json::JsonDocument ^ SerializeToDocument(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member SerializeToDocument : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, jsonTypeInfo As JsonTypeInfo) As JsonDocument
Параметры
- value
- Object
Преобразуемое значение .
- jsonTypeInfo
- JsonTypeInfo
Метаданные о преобразуемом типе.
Возвращаемое значение
Представление JsonDocument значения.
Исключения
jsonTypeInfo равно null.
value не соответствует типу jsonTypeInfo.
Применяется к
SerializeToDocument(Object, Type, JsonSerializerOptions)
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
Преобразует предоставленное значение в JsonDocumentобъект.
[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. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, 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.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
[<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. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
[<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 SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
static member SerializeToDocument : obj * Type * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As JsonDocument
Параметры
- value
- Object
Преобразуемое значение .
- inputType
- Type
Тип преобразуемого value объекта.
- options
- JsonSerializerOptions
Параметры для управления поведением преобразования.
Возвращаемое значение
Представление JsonDocument значения.
- Атрибуты
Исключения
inputType несовместим с value.
inputType равно null.
Нет совместимых JsonConverter элементов inputType или его сериализуемых элементов.
Применяется к
SerializeToDocument(Object, Type, JsonSerializerContext)
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
Преобразует предоставленное значение в JsonDocumentобъект.
public:
static System::Text::Json::JsonDocument ^ SerializeToDocument(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static System.Text.Json.JsonDocument SerializeToDocument(object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member SerializeToDocument : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> System.Text.Json.JsonDocument
Public Function SerializeToDocument (value As Object, inputType As Type, context As JsonSerializerContext) As JsonDocument
Параметры
- value
- Object
Преобразуемое значение .
- inputType
- Type
Тип преобразуемого value объекта.
- context
- JsonSerializerContext
Поставщик метаданных для сериализуемых типов.
Возвращаемое значение
Представление JsonDocument значения.
Исключения
Нет совместимых JsonConverter элементов inputType или его сериализуемых элементов.
Метод GetTypeInfo(Type) предоставленного возвращаемого contextnull типа для преобразуемого типа.
inputType или context есть null.
Применяется к
SerializeToDocument<TValue>(TValue, JsonSerializerOptions)
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
Преобразует предоставленное значение в JsonDocumentобъект.
[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. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
public static System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, 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.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
[<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. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")>]
static member SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
[<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 SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
static member SerializeToDocument : 'Value * System.Text.Json.JsonSerializerOptions -> System.Text.Json.JsonDocument
Public Function SerializeToDocument(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As JsonDocument
Параметры типа
- TValue
Тип сериализации значения.
Параметры
- value
- TValue
Преобразуемое значение .
- options
- JsonSerializerOptions
Параметры для управления поведением преобразования.
Возвращаемое значение
Представление JsonDocument значения JSON.
- Атрибуты
Исключения
Нет совместимых JsonConverter элементов TValue или его сериализуемых элементов.
Применяется к
SerializeToDocument<TValue>(TValue, JsonTypeInfo<TValue>)
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
- Исходный код:
- JsonSerializer.Write.Document.cs
Преобразует предоставленное значение в JsonDocumentобъект.
public:
generic <typename TValue>
static System::Text::Json::JsonDocument ^ SerializeToDocument(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static System.Text.Json.JsonDocument SerializeToDocument<TValue>(TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member SerializeToDocument : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> System.Text.Json.JsonDocument
Public Function SerializeToDocument(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As JsonDocument
Параметры типа
- TValue
Тип сериализации значения.
Параметры
- value
- TValue
Преобразуемое значение .
- jsonTypeInfo
- JsonTypeInfo<TValue>
Метаданные о преобразуемом типе.
Возвращаемое значение
Представление JsonDocument значения.
Исключения
Нет совместимых JsonConverter элементов TValue или его сериализуемых элементов.
jsonTypeInfo равно null.