A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.microsoft.com/en-us/dotnet/api/system.text.json.jsonserializer.serialize below:

JsonSerializer.Serialize Method (System.Text.Json) | Microsoft Learn

JsonSerializer.Serialize Method Definition Overloads Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext)

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)
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs

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
value
Object

The value to convert and write.

inputType
Type

The type of the value to convert.

Exceptions

inputType is not compatible with value

writer or inputType is null.

There is no compatible JsonConverter for inputType or its serializable members.

Remarks

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)
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs

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
value
Object

The value to convert and write.

jsonTypeInfo
JsonTypeInfo

Metadata about the type to convert.

Exceptions

writer or jsonTypeInfo is null.

value does not match the type of jsonTypeInfo.

Serialize(Stream, Object, Type, JsonSerializerContext)
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs

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
value
Object

The value to convert.

inputType
Type

The type of the value to convert.

Exceptions

inputType is not compatible with value.

utf8Json, inputType, or context is null.

There is no compatible JsonConverter for inputType or its serializable members.

Serialize(Object, Type, JsonSerializerOptions)
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs

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
value
Object

The value to convert.

inputType
Type

The type of the value to convert.

Returns

The JSON string representation of the value.

Exceptions

inputType is not compatible with value.

There is no compatible JsonConverter for inputType or its serializable members.

Remarks

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)
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs

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
value
Object

The value to convert.

jsonTypeInfo
JsonTypeInfo

Metadata about the type to convert.

Exceptions

value does not match the type of jsonTypeInfo.

Serialize(Object, JsonTypeInfo) Serialize(Object, Type, JsonSerializerContext)
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs

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
value
Object

The value to convert.

inputType
Type

The type of the value to convert.

Returns

A String representation of the value.

Exceptions

There 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.

Remarks

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)
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs
Source:
JsonSerializer.Write.String.cs

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
TValue

The type of the value to serialize.

Parameters
value
TValue

The value to convert.

Returns

A JSON string representation of the value.

Exceptions

There is no compatible JsonConverter for TValue or its serializable members.

Remarks

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>)
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs
Source:
JsonSerializer.Write.Stream.cs

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
TValue

The type of the value to serialize.

Parameters
value
TValue

The value to convert.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata about the type to convert.

Exceptions

There is no compatible JsonConverter for TValue or its serializable members.

Serialize<TValue>(Utf8JsonWriter, TValue, JsonSerializerOptions)
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs

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
TValue

The type of the value to serialize.

Parameters
value
TValue

The value to convert and write.

Exceptions

There is no compatible JsonConverter for TValue or its serializable members.

Remarks

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>)
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs
Source:
JsonSerializer.Write.Utf8JsonWriter.cs

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
TValue

The type of the value to serialize.

Parameters
value
TValue

The value to convert and write.

jsonTypeInfo
JsonTypeInfo<TValue>

Metadata about the type to convert.

Exceptions

writer 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 article

Was 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