JsonSerializer.Serialize Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Aşırı Yüklemeler
| Name | Description |
|---|---|
| Serialize(Object, JsonTypeInfo) |
Sağlanan değeri değerine Stringdönüştürür. |
| Serialize(Stream, Object, JsonTypeInfo) |
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar. |
| Serialize(Object, Type, JsonSerializerOptions) |
Belirtilen türün değerini JSON dizesine dönüştürür. |
| Serialize(Object, Type, JsonSerializerContext) |
Sağlanan değeri değerine Stringdönüştürür. |
| Serialize(Utf8JsonWriter, Object, JsonTypeInfo) |
Sağlanan yazıcıya bir JSON değeri (nesneler veya diziler dahil) yazar. |
| Serialize(Stream, Object, Type, JsonSerializerOptions) |
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar. |
| Serialize(Stream, Object, Type, JsonSerializerContext) |
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar. |
| Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions) |
Belirtilen türün JSON gösterimini sağlanan yazıcıya yazar. |
| Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext) |
Sağlanan yazıcıya bir JSON değeri (nesneler veya diziler dahil) yazar. |
| Serialize<TValue>(Utf8JsonWriter, TValue, JsonTypeInfo<TValue>) |
Sağlanan yazıcıya bir JSON değeri (nesneler veya diziler dahil) yazar. |
| Serialize<TValue>(Utf8JsonWriter, TValue, JsonSerializerOptions) |
Sağlanan yazıcıya genel tür parametresi tarafından belirtilen bir türün JSON gösterimini yazar. |
| Serialize<TValue>(Stream, TValue, JsonTypeInfo<TValue>) |
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar. |
| Serialize<TValue>(TValue, JsonSerializerOptions) |
Genel tür parametresi tarafından belirtilen türün değerini JSON dizesine dönüştürür. |
| Serialize<TValue>(TValue, JsonTypeInfo<TValue>) |
Sağlanan değeri değerine Stringdönüştürür. |
| Serialize<TValue>(Stream, TValue, JsonSerializerOptions) |
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar. |
Serialize(Object, JsonTypeInfo)
Sağlanan değeri değerine Stringdönüştürür.
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
Parametreler
- value
- Object
Dönüştürülecek değer.
- jsonTypeInfo
- JsonTypeInfo
Dönüştürülecek tür hakkındaki meta veriler.
Döndürülenler
String Değerin gösterimi.
Özel durumlar
jsonTypeInfo, null'e eşittir.
value türüyle jsonTypeInfoeşleşmiyor.
Açıklamalar
String Uygulama dahili olarak UTF-8 kullandığından utf-8 kodlaması kullanmak kadar verimli değildir. Ayrıca bkz. SerializeToUtf8Bytes(Object, JsonTypeInfo) ve SerializeAsync(Stream, Object, JsonTypeInfo, CancellationToken).
Şunlara uygulanır
Serialize(Stream, Object, JsonTypeInfo)
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar.
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)
Parametreler
- value
- Object
Dönüştürülecek değer.
- jsonTypeInfo
- JsonTypeInfo
Dönüştürülecek tür hakkındaki meta veriler.
Özel durumlar
utf8Json, null'e eşittir.
value türüyle jsonTypeInfoeşleşmiyor.
Şunlara uygulanır
Serialize(Object, Type, JsonSerializerOptions)
Belirtilen türün değerini JSON dizesine dönüştürür.
[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
Parametreler
- value
- Object
Dönüştürülecek değer.
- inputType
- Type
Dönüştürülecek öğesinin value türü.
- options
- JsonSerializerOptions
Dönüştürme davranışını denetleme seçenekleri.
Döndürülenler
Değerin JSON dize gösterimi.
- Öznitelikler
Özel durumlar
inputType
valueile uyumlu değildir.
inputType, null'e eşittir.
için JsonConverter uyumlu inputType veya serileştirilebilir üyeleri yok.
Açıklamalar
String Uygulama dahili olarak UTF-8 kullandığından utf-8 kodlaması kullanmak kadar verimli değildir. Ayrıca bkz. SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions) ve SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken).
Daha fazla bilgi için bkz. JSON'ı seri hale getirme ve seri durumdan çıkarma.
Şunlara uygulanır
Serialize(Object, Type, JsonSerializerContext)
Sağlanan değeri değerine Stringdönüştürür.
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
Parametreler
- value
- Object
Dönüştürülecek değer.
- inputType
- Type
Dönüştürülecek öğesinin value türü.
- context
- JsonSerializerContext
Serileştirilebilir türler için meta veri sağlayıcısı.
Döndürülenler
String Değerin gösterimi.
Özel durumlar
için JsonConverter uyumlu inputType veya serileştirilebilir üyeleri yok.
GetTypeInfo(Type) Sağlanan context yöntemi, dönüştürülecek türü döndürürnull.
inputType veya context şeklindedir null.
Açıklamalar
String Uygulama dahili olarak UTF-8 kullandığından utf-8 kodlaması kullanmak kadar verimli değildir. Ayrıca bkz SerializeToUtf8Bytes(Object, Type, JsonSerializerContext) . ve SerializeAsync(Stream, Object, Type, JsonSerializerContext, CancellationToken).
Şunlara uygulanır
Serialize(Utf8JsonWriter, Object, JsonTypeInfo)
Sağlanan yazıcıya bir JSON değeri (nesneler veya diziler dahil) yazar.
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)
Parametreler
- writer
- Utf8JsonWriter
Yazacak yazar.
- value
- Object
Dönüştürülecek ve yazacak değer.
- jsonTypeInfo
- JsonTypeInfo
Dönüştürülecek tür hakkındaki meta veriler.
Özel durumlar
writer veya jsonTypeInfo şeklindedir null.
value türüyle jsonTypeInfoeşleşmiyor.
Şunlara uygulanır
Serialize(Stream, Object, Type, JsonSerializerOptions)
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar.
[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)
Parametreler
- value
- Object
Dönüştürülecek değer.
- inputType
- Type
Dönüştürülecek öğesinin value türü.
- options
- JsonSerializerOptions
Dönüştürme davranışını denetleme seçenekleri.
- Öznitelikler
Özel durumlar
inputType
valueile uyumlu değildir.
utf8Json veya inputType şeklindedir null.
için JsonConverter uyumlu inputType veya serileştirilebilir üyeleri yok.
Şunlara uygulanır
Serialize(Stream, Object, Type, JsonSerializerContext)
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar.
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)
Parametreler
- value
- Object
Dönüştürülecek değer.
- inputType
- Type
Dönüştürülecek öğesinin value türü.
- context
- JsonSerializerContext
Serileştirilebilir türler için meta veri sağlayıcısı.
Özel durumlar
inputType
valueile uyumlu değildir.
utf8Json, inputTypeveya contextnull.
için JsonConverter uyumlu inputType veya serileştirilebilir üyeleri yok.
Şunlara uygulanır
Serialize(Utf8JsonWriter, Object, Type, JsonSerializerOptions)
Belirtilen türün JSON gösterimini sağlanan yazıcıya yazar.
[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)
Parametreler
- writer
- Utf8JsonWriter
Yazacak JSON yazıcısı.
- value
- Object
Dönüştürülecek ve yazacak değer.
- inputType
- Type
Dönüştürülecek öğesinin value türü.
- options
- JsonSerializerOptions
Serileştirme davranışını denetleme seçenekleri.
- Öznitelikler
Özel durumlar
inputType ile uyumlu değil value
writer veya inputType şeklindedir null.
için JsonConverter uyumlu inputType veya serileştirilebilir üyeleri yok.
Açıklamalar
JsonWriterOptions örneğini Utf8JsonWriter oluşturmak için kullanılan, çakıştığında önceliğe JsonSerializerOptions sahiptir. Bu nedenle, JsonWriterOptions.Indented, JsonWriterOptions.SkipValidationve JsonWriterOptions.Encoder yazılırken kullanılır.
Daha fazla bilgi için bkz. JSON'ı seri hale getirme ve seri durumdan çıkarma.
Şunlara uygulanır
Serialize(Utf8JsonWriter, Object, Type, JsonSerializerContext)
Sağlanan yazıcıya bir JSON değeri (nesneler veya diziler dahil) yazar.
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)
Parametreler
- writer
- Utf8JsonWriter
Yazacak bir JSON yazarı.
- value
- Object
Dönüştürülecek ve yazacak değer.
- inputType
- Type
Dönüştürülecek öğesinin value türü.
- context
- JsonSerializerContext
Serileştirilebilir türler için meta veri sağlayıcısı.
Özel durumlar
inputType
valueile uyumlu değildir.
writer veya inputType şeklindedir null.
için JsonConverter uyumlu inputType veya serileştirilebilir üyeleri yok.
GetTypeInfo(Type) Sağlanan context yöntemi, dönüştürülecek türü döndürürnull.
Şunlara uygulanır
Serialize<TValue>(Utf8JsonWriter, TValue, JsonTypeInfo<TValue>)
Sağlanan yazıcıya bir JSON değeri (nesneler veya diziler dahil) yazar.
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))
Tür Parametreleri
- TValue
Serileştirecek değerin türü.
Parametreler
- writer
- Utf8JsonWriter
Yazacak yazar.
- value
- TValue
Dönüştürülecek ve yazacak değer.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Dönüştürülecek tür hakkındaki meta veriler.
Özel durumlar
writer veya jsonTypeInfo şeklindedir null.
için JsonConverter uyumlu TValue veya serileştirilebilir üyeleri yok.
Şunlara uygulanır
Serialize<TValue>(Utf8JsonWriter, TValue, JsonSerializerOptions)
Sağlanan yazıcıya genel tür parametresi tarafından belirtilen bir türün JSON gösterimini yazar.
[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)
Tür Parametreleri
- TValue
Serileştirecek değerin türü.
Parametreler
- writer
- Utf8JsonWriter
Yazacak bir JSON yazarı.
- value
- TValue
Dönüştürülecek ve yazacak değer.
- options
- JsonSerializerOptions
Serileştirme davranışını denetleme seçenekleri.
- Öznitelikler
Özel durumlar
writer, null'e eşittir.
için JsonConverter uyumlu TValue veya serileştirilebilir üyeleri yok.
Açıklamalar
JsonWriterOptions örneğini Utf8JsonWriter oluşturmak için kullanılan, çakıştığında önceliğe JsonSerializerOptions sahiptir. Bu nedenle, JsonWriterOptions.Indented, JsonWriterOptions.SkipValidationve JsonWriterOptions.Encoder yazılırken kullanılır.
Daha fazla bilgi için bkz. JSON'ı seri hale getirme ve seri durumdan çıkarma.
Şunlara uygulanır
Serialize<TValue>(Stream, TValue, JsonTypeInfo<TValue>)
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar.
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))
Tür Parametreleri
- TValue
Serileştirecek değerin türü.
Parametreler
- value
- TValue
Dönüştürülecek değer.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Dönüştürülecek tür hakkındaki meta veriler.
Özel durumlar
utf8Json, null'e eşittir.
için JsonConverter uyumlu TValue veya serileştirilebilir üyeleri yok.
Şunlara uygulanır
Serialize<TValue>(TValue, JsonSerializerOptions)
Genel tür parametresi tarafından belirtilen türün değerini JSON dizesine dönüştürür.
[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
Tür Parametreleri
- TValue
Serileştirecek değerin türü.
Parametreler
- value
- TValue
Dönüştürülecek değer.
- options
- JsonSerializerOptions
Serileştirme davranışını denetleme seçenekleri.
Döndürülenler
Değerin JSON dize gösterimi.
- Öznitelikler
Özel durumlar
için JsonConverter uyumlu TValue veya serileştirilebilir üyeleri yok.
Açıklamalar
String Uygulama dahili olarak UTF-8 kullandığından utf-8 kodlaması kullanmak kadar verimli değildir. Ayrıca bkz. SerializeToUtf8Bytes(Object, Type, JsonSerializerOptions) ve SerializeAsync(Stream, Object, Type, JsonSerializerOptions, CancellationToken).
Daha fazla bilgi için bkz. JSON'ı seri hale getirme ve seri durumdan çıkarma.
Şunlara uygulanır
Serialize<TValue>(TValue, JsonTypeInfo<TValue>)
Sağlanan değeri değerine Stringdönüştürür.
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
Tür Parametreleri
- TValue
Serileştirecek değerin türü.
Parametreler
- value
- TValue
Dönüştürülecek değer.
- jsonTypeInfo
- JsonTypeInfo<TValue>
Dönüştürülecek tür hakkındaki meta veriler.
Döndürülenler
String Değerin gösterimi.
Özel durumlar
için JsonConverter uyumlu TValue veya serileştirilebilir üyeleri yok.
jsonTypeInfo, null'e eşittir.
Açıklamalar
String Uygulama dahili olarak UTF-8 kullandığından utf-8 kodlaması kullanmak kadar verimli değildir. Ayrıca bkz. SerializeToUtf8Bytes<TValue>(TValue, JsonTypeInfo<TValue>) ve SerializeAsync<TValue>(Stream, TValue, JsonTypeInfo<TValue>, CancellationToken).
Şunlara uygulanır
Serialize<TValue>(Stream, TValue, JsonSerializerOptions)
Sağlanan değeri UTF-8 kodlanmış JSON metnine Streamdönüştürür ve dosyasına yazar.
[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)
Tür Parametreleri
- TValue
Serileştirecek değerin türü.
Parametreler
- value
- TValue
Dönüştürülecek değer.
- options
- JsonSerializerOptions
Dönüştürme davranışını denetleme seçenekleri.
- Öznitelikler
Özel durumlar
utf8Json, null'e eşittir.
için JsonConverter uyumlu TValue veya serileştirilebilir üyeleri yok.