Writes one JSON value (including objects or arrays) to the provided writer.
Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)Writes the JSON representation of the specified type to the provided writer.
Serialize(Stream, Object, Type, JsonSerializerOptions)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
Serialize(Utf8JsonWriter, Object, JsonTypeInfo)Writes one JSON value (including objects or arrays) to the provided writer.
Serialize(Stream, Object, Type, JsonSerializerContext)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
Serialize(Object, Type, JsonSerializerOptions)Converts the value of a specified type into a JSON string.
Serialize(Stream, Object, JsonTypeInfo)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
Serialize(Object, JsonTypeInfo)Converts the provided value into a String.
Serialize(Object, Type, JsonSerializerContext)Converts the provided value into a String.
Serialize<TValue>(TValue, JsonSerializerOptions)Converts the value of a type specified by a generic type parameter into a JSON string.
Serialize<TValue>(TValue, JsonTypeInfo<TValue>)Converts the provided value into a String.
Serialize<TValue>(Stream, TValue, JsonSerializerOptions)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
Serialize<TValue>(Stream, TValue, JsonTypeInfo<TValue>)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
Serialize<TValue>(Utf8JsonWriter, TValue, JsonSerializerOptions)Writes the JSON representation of a type specified by a generic type parameter to the provided writer.
Serialize<TValue>(Utf8JsonWriter, TValue, JsonTypeInfo<TValue>)Writes one JSON value (including objects or arrays) to the provided writer.
Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext) Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)Writes the JSON representation of the specified type to the provided writer.
public static void Serialize(System.Text.Json.Utf8JsonWriter writer, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static void Serialize(System.Text.Json.Utf8JsonWriter writer, object value, Type inputType, System.Text.Json.JsonSerializerOptions options = default);
static member Serialize : System.Text.Json.Utf8JsonWriter * obj * Type * System.Text.Json.JsonSerializerOptions -> unit
Public Sub Serialize (writer As Utf8JsonWriter, value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing)
Public Shared Sub Serialize (writer As Utf8JsonWriter, value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing)
Parameters
The value to convert and write.
The type of the value
to convert.
inputType
is not compatible with value
writer
or inputType
is null
.
There is no compatible JsonConverter for inputType
or its serializable members.
The JsonWriterOptions used to create the instance of the Utf8JsonWriter take precedence over the JsonSerializerOptions when they conflict. Hence, JsonWriterOptions.Indented, JsonWriterOptions.SkipValidation, and JsonWriterOptions.Encoder are used while writing.
For more information, see How to serialize and deserialize JSON.
Serialize(Stream, Object, Type, JsonSerializerOptions) Serialize(Utf8JsonWriter, Object, JsonTypeInfo)Writes one JSON value (including objects or arrays) to the provided writer.
public:
static void Serialize(System::Text::Json::Utf8JsonWriter ^ writer, System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static void Serialize(System.Text.Json.Utf8JsonWriter writer, object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Serialize : System.Text.Json.Utf8JsonWriter * obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> unit
Public Sub Serialize (writer As Utf8JsonWriter, value As Object, jsonTypeInfo As JsonTypeInfo)
Parameters
The value to convert and write.
Metadata about the type to convert.
Exceptionswriter
or jsonTypeInfo
is null
.
value
does not match the type of jsonTypeInfo
.
Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
public:
static void Serialize(System::IO::Stream ^ utf8Json, System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static void Serialize(System.IO.Stream utf8Json, object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Serialize : System.IO.Stream * obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> unit
Public Sub Serialize (utf8Json As Stream, value As Object, inputType As Type, context As JsonSerializerContext)
Parameters
The value to convert.
The type of the value
to convert.
inputType
is not compatible with value
.
utf8Json
, inputType
, or context
is null
.
There is no compatible JsonConverter for inputType
or its serializable members.
Converts the value of a specified type into a JSON string.
public static string Serialize(object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static string Serialize(object value, Type inputType, System.Text.Json.JsonSerializerOptions options = default);
static member Serialize : obj * Type * System.Text.Json.JsonSerializerOptions -> string
Public Function Serialize (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As String
Public Shared Function Serialize (value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing) As String
Parameters
The value to convert.
The type of the value
to convert.
The JSON string representation of the value.
ExceptionsinputType
is not compatible with value
.
There is no compatible JsonConverter for inputType
or its serializable members.
Using a String is not as efficient as using UTF-8 encoding since the implementation internally uses UTF-8. See also SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions) and SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken).
For more information, see How to serialize and deserialize JSON.
Serialize(Stream, Object, JsonTypeInfo)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
public:
static void Serialize(System::IO::Stream ^ utf8Json, System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static void Serialize(System.IO.Stream utf8Json, object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Serialize : System.IO.Stream * obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> unit
Public Sub Serialize (utf8Json As Stream, value As Object, jsonTypeInfo As JsonTypeInfo)
Parameters
The value to convert.
Metadata about the type to convert.
Exceptionsvalue
does not match the type of jsonTypeInfo
.
Converts the provided value into a String.
public:
static System::String ^ Serialize(System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static string Serialize(object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Serialize : obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> string
Public Function Serialize (value As Object, inputType As Type, context As JsonSerializerContext) As String
Parameters
The value to convert.
The type of the value
to convert.
A String representation of the value.
ExceptionsThere is no compatible JsonConverter for inputType
or its serializable members.
The GetTypeInfo(Type) method of the provided context
returns null
for the type to convert.
inputType
or context
is null
.
Using a String is not as efficient as using UTF-8 encoding, since the implementation internally uses UTF-8. Also see SerializeToUtf8Bytes(Object, Type, JsonSerializerContext) and SerializeAsync(Stream, Object, Type, JsonSerializerContext, CancellationToken).
Serialize<TValue>(TValue, JsonSerializerOptions)Converts the value of a type specified by a generic type parameter into a JSON string.
public static string Serialize<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static string Serialize<TValue>(TValue value, System.Text.Json.JsonSerializerOptions options = default);
static member Serialize : 'Value * System.Text.Json.JsonSerializerOptions -> string
Public Function Serialize(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As String
Public Shared Function Serialize(Of TValue) (value As TValue, Optional options As JsonSerializerOptions = Nothing) As String
Type Parameters
The type of the value to serialize.
ParametersThe value to convert.
ReturnsA JSON string representation of the value.
ExceptionsThere is no compatible JsonConverter for TValue
or its serializable members.
Using a String is not as efficient as using UTF-8 encoding since the implementation internally uses UTF-8. See also SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions) and SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken).
For more information, see How to serialize and deserialize JSON.
Serialize<TValue>(TValue, JsonTypeInfo<TValue>) Serialize<TValue>(Stream, TValue, JsonSerializerOptions) Serialize<TValue>(Stream, TValue, JsonTypeInfo<TValue>)Converts the provided value to UTF-8 encoded JSON text and write it to the Stream.
public:
generic <typename TValue>
static void Serialize(System::IO::Stream ^ utf8Json, TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static void Serialize<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Serialize : System.IO.Stream * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> unit
Public Sub Serialize(Of TValue) (utf8Json As Stream, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue))
Type Parameters
The type of the value to serialize.
ParametersThe value to convert.
Metadata about the type to convert.
ExceptionsThere is no compatible JsonConverter for TValue
or its serializable members.
Writes the JSON representation of a type specified by a generic type parameter to the provided writer.
public static void Serialize<TValue>(System.Text.Json.Utf8JsonWriter writer, TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static void Serialize<TValue>(System.Text.Json.Utf8JsonWriter writer, TValue value, System.Text.Json.JsonSerializerOptions options = default);
static member Serialize : System.Text.Json.Utf8JsonWriter * 'Value * System.Text.Json.JsonSerializerOptions -> unit
Public Sub Serialize(Of TValue) (writer As Utf8JsonWriter, value As TValue, Optional options As JsonSerializerOptions = Nothing)
Public Shared Sub Serialize(Of TValue) (writer As Utf8JsonWriter, value As TValue, Optional options As JsonSerializerOptions = Nothing)
Type Parameters
The type of the value to serialize.
ParametersThe value to convert and write.
ExceptionsThere is no compatible JsonConverter for TValue
or its serializable members.
The JsonWriterOptions used to create the instance of the Utf8JsonWriter take precedence over the JsonSerializerOptions when they conflict. Hence, JsonWriterOptions.Indented, JsonWriterOptions.SkipValidation, and JsonWriterOptions.Encoder are used while writing.
For more information, see How to serialize and deserialize JSON.
Serialize<TValue>(Utf8JsonWriter, TValue, JsonTypeInfo<TValue>)Writes one JSON value (including objects or arrays) to the provided writer.
public:
generic <typename TValue>
static void Serialize(System::Text::Json::Utf8JsonWriter ^ writer, TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static void Serialize<TValue>(System.Text.Json.Utf8JsonWriter writer, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Serialize : System.Text.Json.Utf8JsonWriter * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> unit
Public Sub Serialize(Of TValue) (writer As Utf8JsonWriter, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue))
Type Parameters
The type of the value to serialize.
ParametersThe value to convert and write.
Metadata about the type to convert.
Exceptionswriter
or jsonTypeInfo
is null
.
There is no compatible JsonConverter for TValue
or its serializable members.
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4