JsonSerializer.Serialize 메서드

정의

오버로드

Name Description
Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext)

제공된 작성기에 하나의 JSON 값(개체 또는 배열 포함)을 씁니다.

Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)

지정된 형식의 JSON 표현을 제공된 작성기에 씁니다.

Serialize(Stream, Object, Type, JsonSerializerOptions)

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

Serialize(Utf8JsonWriter, Object, JsonTypeInfo)

제공된 작성기에 하나의 JSON 값(개체 또는 배열 포함)을 씁니다.

Serialize(Stream, Object, Type, JsonSerializerContext)

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

Serialize(Object, Type, JsonSerializerOptions)

지정된 형식의 값을 JSON 문자열로 변환합니다.

Serialize(Stream, Object, JsonTypeInfo)

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

Serialize(Object, JsonTypeInfo)

제공된 값을 으로 String변환합니다.

Serialize(Object, Type, JsonSerializerContext)

제공된 값을 으로 String변환합니다.

Serialize<TValue>(TValue, JsonSerializerOptions)

제네릭 형식 매개 변수로 지정된 형식의 값을 JSON 문자열로 변환합니다.

Serialize<TValue>(TValue, JsonTypeInfo<TValue>)

제공된 값을 으로 String변환합니다.

Serialize<TValue>(Stream, TValue, JsonSerializerOptions)

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

Serialize<TValue>(Stream, TValue, JsonTypeInfo<TValue>)

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

Serialize<TValue>(Utf8JsonWriter, TValue, JsonSerializerOptions)

제네릭 형식 매개 변수로 지정된 형식의 JSON 표현을 제공된 작성기에 씁니다.

Serialize<TValue>(Utf8JsonWriter, TValue, JsonTypeInfo<TValue>)

제공된 작성기에 하나의 JSON 값(개체 또는 배열 포함)을 씁니다.

Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext)

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

제공된 작성기에 하나의 JSON 값(개체 또는 배열 포함)을 씁니다.

public:
 static void Serialize(System::Text::Json::Utf8JsonWriter ^ writer, System::Object ^ value, Type ^ inputType, System::Text::Json::Serialization::JsonSerializerContext ^ context);
public static void Serialize(System.Text.Json.Utf8JsonWriter writer, object? value, Type inputType, System.Text.Json.Serialization.JsonSerializerContext context);
static member Serialize : System.Text.Json.Utf8JsonWriter * obj * Type * System.Text.Json.Serialization.JsonSerializerContext -> unit
Public Sub Serialize (writer As Utf8JsonWriter, value As Object, inputType As Type, context As JsonSerializerContext)

매개 변수

writer
Utf8JsonWriter

쓸 JSON 작성기입니다.

value
Object

변환하고 쓸 값입니다.

inputType
Type

변환할 형식입니다 value .

context
JsonSerializerContext

직렬화 가능한 형식에 대한 메타데이터 공급자입니다.

예외

inputType value호환되지 않습니다.

writer 또는 inputType .입니다 null.

직렬화할 수 있는 멤버나 호환 JsonConverterinputType 되는 멤버는 없습니다.

GetTypeInfo(Type) 변환할 형식에 대해 제공된 context 반환 null 의 메서드입니다.

적용 대상

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

지정된 형식의 JSON 표현을 제공된 작성기에 씁니다.

[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 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);
[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 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);
[<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 Serialize : System.Text.Json.Utf8JsonWriter * obj * Type * System.Text.Json.JsonSerializerOptions -> unit
static member Serialize : System.Text.Json.Utf8JsonWriter * obj * Type * System.Text.Json.JsonSerializerOptions -> unit
[<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 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)

매개 변수

writer
Utf8JsonWriter

쓸 JSON 작성기입니다.

value
Object

변환하고 쓸 값입니다.

inputType
Type

변환할 형식입니다 value .

options
JsonSerializerOptions

serialization 동작을 제어하는 옵션입니다.

특성

예외

inputType 와 호환되지 않습니다. value

writer 또는 inputType .입니다 null.

직렬화할 수 있는 멤버나 호환 JsonConverterinputType 되는 멤버는 없습니다.

설명

JsonWriterOptions 충돌할 때보다 우선적으로 적용할 Utf8JsonWriter 인스턴스를 JsonSerializerOptions 만드는 데 사용됩니다. 따라서, JsonWriterOptions.Indented, JsonWriterOptions.SkipValidationJsonWriterOptions.Encoder 작성 하는 동안 사용 합니다.

자세한 내용은 JSON을 직렬화 및 역직렬화하는 방법을 참조하세요.

적용 대상

Serialize(Stream, Object, Type, JsonSerializerOptions)

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

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

[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 void Serialize(System.IO.Stream utf8Json, 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 void Serialize(System.IO.Stream utf8Json, object? value, Type inputType, System.Text.Json.JsonSerializerOptions? options = default);
public static void Serialize(System.IO.Stream utf8Json, 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 Serialize : System.IO.Stream * obj * Type * System.Text.Json.JsonSerializerOptions -> unit
[<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 Serialize : System.IO.Stream * obj * Type * System.Text.Json.JsonSerializerOptions -> unit
static member Serialize : System.IO.Stream * obj * Type * System.Text.Json.JsonSerializerOptions -> unit
Public Sub Serialize (utf8Json As Stream, value As Object, inputType As Type, Optional options As JsonSerializerOptions = Nothing)

매개 변수

utf8Json
Stream

쓸 UTF-8 Stream 입니다.

value
Object

변환할 값입니다.

inputType
Type

변환할 형식입니다 value .

options
JsonSerializerOptions

변환 동작을 제어하는 옵션입니다.

특성

예외

inputType value호환되지 않습니다.

utf8Json 또는 inputType .입니다 null.

직렬화할 수 있는 멤버나 호환 JsonConverterinputType 되는 멤버는 없습니다.

적용 대상

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

제공된 작성기에 하나의 JSON 값(개체 또는 배열 포함)을 씁니다.

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)

매개 변수

writer
Utf8JsonWriter

쓸 작성기입니다.

value
Object

변환하고 쓸 값입니다.

jsonTypeInfo
JsonTypeInfo

변환할 형식에 대한 메타데이터입니다.

예외

writer 또는 jsonTypeInfo .입니다 null.

value 가 .의 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
Source:
JsonSerializer.Write.Stream.cs

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 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)

매개 변수

utf8Json
Stream

쓸 UTF-8 Stream 입니다.

value
Object

변환할 값입니다.

inputType
Type

변환할 형식입니다 value .

context
JsonSerializerContext

직렬화 가능한 형식에 대한 메타데이터 공급자입니다.

예외

inputType value호환되지 않습니다.

utf8Json, inputType또는 context 입니다 null.

직렬화할 수 있는 멤버나 호환 JsonConverterinputType 되는 멤버는 없습니다.

적용 대상

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

지정된 형식의 값을 JSON 문자열로 변환합니다.

[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 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);
[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 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);
[<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 Serialize : obj * Type * System.Text.Json.JsonSerializerOptions -> string
static member Serialize : obj * Type * System.Text.Json.JsonSerializerOptions -> string
[<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 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

매개 변수

value
Object

변환할 값입니다.

inputType
Type

변환할 형식입니다 value .

options
JsonSerializerOptions

변환 동작을 제어하는 옵션입니다.

반품

값의 JSON 문자열 표현입니다.

특성

예외

inputType value호환되지 않습니다.

inputTypenull입니다.

직렬화할 수 있는 멤버나 호환 JsonConverterinputType 되는 멤버는 없습니다.

설명

String 구현에서 UTF-8을 내부적으로 사용하기 때문에 UTF-8 인코딩을 사용하는 것만큼 효율적이지 않습니다. SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken)참조하세요.

자세한 내용은 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
Source:
JsonSerializer.Write.Stream.cs

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 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)

매개 변수

utf8Json
Stream

쓸 UTF-8 Stream 입니다.

value
Object

변환할 값입니다.

jsonTypeInfo
JsonTypeInfo

변환할 형식에 대한 메타데이터입니다.

예외

utf8Jsonnull입니다.

value 가 .의 jsonTypeInfo형식과 일치하지 않습니다.

적용 대상

Serialize(Object, JsonTypeInfo)

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

제공된 값을 으로 String변환합니다.

public:
 static System::String ^ Serialize(System::Object ^ value, System::Text::Json::Serialization::Metadata::JsonTypeInfo ^ jsonTypeInfo);
public static string Serialize(object? value, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo);
static member Serialize : obj * System.Text.Json.Serialization.Metadata.JsonTypeInfo -> string
Public Function Serialize (value As Object, jsonTypeInfo As JsonTypeInfo) As String

매개 변수

value
Object

변환할 값입니다.

jsonTypeInfo
JsonTypeInfo

변환할 형식에 대한 메타데이터입니다.

반품

String 값의 표현입니다.

예외

jsonTypeInfonull입니다.

value 가 .의 jsonTypeInfo형식과 일치하지 않습니다.

설명

String 구현에서 UTF-8을 내부적으로 사용하기 때문에 UTF-8 인코딩을 사용하는 것만큼 효율적이지 않습니다. SerializeToUtf8Bytes(Object, JsonTypeInfo)SerializeAsync(Stream, Object, JsonTypeInfo, CancellationToken)참조하세요.

적용 대상

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

제공된 값을 으로 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

매개 변수

value
Object

변환할 값입니다.

inputType
Type

변환할 형식입니다 value .

context
JsonSerializerContext

직렬화 가능한 형식에 대한 메타데이터 공급자입니다.

반품

String 값의 표현입니다.

예외

직렬화할 수 있는 멤버나 호환 JsonConverterinputType 되는 멤버는 없습니다.

GetTypeInfo(Type) 변환할 형식에 대해 제공된 context 반환 null 의 메서드입니다.

inputType 또는 context .입니다 null.

설명

String 구현은 내부적으로 UTF-8을 사용하기 때문에 UTF-8 인코딩을 사용하는 것만큼 효율적이지 않습니다. 또한 참조 SerializeToUtf8Bytes(Object, Type, JsonSerializerContext)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
Source:
JsonSerializer.Write.String.cs

제네릭 형식 매개 변수로 지정된 형식의 값을 JSON 문자열로 변환합니다.

[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 string Serialize<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static string Serialize<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 string Serialize<TValue>(TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static string Serialize<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 Serialize : 'Value * System.Text.Json.JsonSerializerOptions -> string
static member Serialize : 'Value * System.Text.Json.JsonSerializerOptions -> string
[<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 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

형식 매개 변수

TValue

serialize할 값의 형식입니다.

매개 변수

value
TValue

변환할 값입니다.

options
JsonSerializerOptions

serialization 동작을 제어하는 옵션입니다.

반품

값의 JSON 문자열 표현입니다.

특성

예외

직렬화할 수 있는 멤버나 호환 JsonConverterTValue 되는 멤버는 없습니다.

설명

String 구현에서 UTF-8을 내부적으로 사용하기 때문에 UTF-8 인코딩을 사용하는 것만큼 효율적이지 않습니다. SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions)SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken)참조하세요.

자세한 내용은 JSON을 직렬화 및 역직렬화하는 방법을 참조하세요.

적용 대상

Serialize<TValue>(TValue, JsonTypeInfo<TValue>)

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

제공된 값을 으로 String변환합니다.

public:
generic <typename TValue>
 static System::String ^ Serialize(TValue value, System::Text::Json::Serialization::Metadata::JsonTypeInfo<TValue> ^ jsonTypeInfo);
public static string Serialize<TValue>(TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo);
static member Serialize : 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> -> string
Public Function Serialize(Of TValue) (value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue)) As String

형식 매개 변수

TValue

serialize할 값의 형식입니다.

매개 변수

value
TValue

변환할 값입니다.

jsonTypeInfo
JsonTypeInfo<TValue>

변환할 형식에 대한 메타데이터입니다.

반품

String 값의 표현입니다.

예외

직렬화할 수 있는 멤버나 호환 JsonConverterTValue 되는 멤버는 없습니다.

jsonTypeInfonull입니다.

설명

String 구현에서 UTF-8을 내부적으로 사용하기 때문에 UTF-8 인코딩을 사용하는 것만큼 효율적이지 않습니다. SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>)SerializeAsync<TValue>(Stream, TValue, JsonTypeInfo<TValue>, CancellationToken)참조하세요.

적용 대상

Serialize<TValue>(Stream, TValue, JsonSerializerOptions)

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

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 Stream씁니다.

[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 void Serialize<TValue>(System.IO.Stream utf8Json, 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 void Serialize<TValue>(System.IO.Stream utf8Json, TValue value, System.Text.Json.JsonSerializerOptions? options = default);
public static void Serialize<TValue>(System.IO.Stream utf8Json, 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 Serialize : System.IO.Stream * 'Value * System.Text.Json.JsonSerializerOptions -> unit
[<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 Serialize : System.IO.Stream * 'Value * System.Text.Json.JsonSerializerOptions -> unit
static member Serialize : System.IO.Stream * 'Value * System.Text.Json.JsonSerializerOptions -> unit
Public Sub Serialize(Of TValue) (utf8Json As Stream, value As TValue, Optional options As JsonSerializerOptions = Nothing)

형식 매개 변수

TValue

serialize할 값의 형식입니다.

매개 변수

utf8Json
Stream

쓸 UTF-8 Stream 입니다.

value
TValue

변환할 값입니다.

options
JsonSerializerOptions

변환 동작을 제어하는 옵션입니다.

특성

예외

utf8Jsonnull입니다.

직렬화할 수 있는 멤버나 호환 JsonConverterTValue 되는 멤버는 없습니다.

적용 대상

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

제공된 값을 UTF-8로 인코딩된 JSON 텍스트로 변환하고 해당 텍스트에 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))

형식 매개 변수

TValue

serialize할 값의 형식입니다.

매개 변수

utf8Json
Stream

쓸 UTF-8 Stream 입니다.

value
TValue

변환할 값입니다.

jsonTypeInfo
JsonTypeInfo<TValue>

변환할 형식에 대한 메타데이터입니다.

예외

utf8Jsonnull입니다.

직렬화할 수 있는 멤버나 호환 JsonConverterTValue 되는 멤버는 없습니다.

적용 대상

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

제네릭 형식 매개 변수로 지정된 형식의 JSON 표현을 제공된 작성기에 씁니다.

[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 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);
[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 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);
[<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 Serialize : System.Text.Json.Utf8JsonWriter * 'Value * System.Text.Json.JsonSerializerOptions -> unit
static member Serialize : System.Text.Json.Utf8JsonWriter * 'Value * System.Text.Json.JsonSerializerOptions -> unit
[<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 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)

형식 매개 변수

TValue

serialize할 값의 형식입니다.

매개 변수

writer
Utf8JsonWriter

쓸 JSON 작성기입니다.

value
TValue

변환하고 쓸 값입니다.

options
JsonSerializerOptions

serialization 동작을 제어하는 옵션입니다.

특성

예외

writernull입니다.

직렬화할 수 있는 멤버나 호환 JsonConverterTValue 되는 멤버는 없습니다.

설명

JsonWriterOptions 충돌할 때보다 우선적으로 적용할 Utf8JsonWriter 인스턴스를 JsonSerializerOptions 만드는 데 사용됩니다. 따라서, JsonWriterOptions.Indented, JsonWriterOptions.SkipValidationJsonWriterOptions.Encoder 작성 하는 동안 사용 합니다.

자세한 내용은 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
Source:
JsonSerializer.Write.Utf8JsonWriter.cs

제공된 작성기에 하나의 JSON 값(개체 또는 배열 포함)을 씁니다.

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))

형식 매개 변수

TValue

serialize할 값의 형식입니다.

매개 변수

writer
Utf8JsonWriter

쓸 작성기입니다.

value
TValue

변환하고 쓸 값입니다.

jsonTypeInfo
JsonTypeInfo<TValue>

변환할 형식에 대한 메타데이터입니다.

예외

writer 또는 jsonTypeInfo .입니다 null.

직렬화할 수 있는 멤버나 호환 JsonConverterTValue 되는 멤버는 없습니다.

적용 대상