Събитие
Създаване на интелигентни приложения
17.03, 23 ч. - 21.03, 23 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаТози браузър вече не се поддържа.
Надстройте до Microsoft Edge, за да се възползвате от най-новите функции, актуализации на защитата и техническа поддръжка.
The System.Text.Json namespace provides functionality for serializing to and deserializing from (or marshalling and unmarshalling) JavaScript Object Notation (JSON). Serialization is the process of converting the state of an object, that is, the values of its properties, into a form that can be stored or transmitted. The serialized form doesn't include any information about an object's associated methods. Deserialization reconstructs an object from the serialized form.
The System.Text.Json
library design emphasizes high performance and low memory allocation over an extensive feature set. Built-in UTF-8 support optimizes the process of reading and writing JSON text encoded as UTF-8, which is the most prevalent encoding for data on the web and files on disk.
The library also provides classes for working with an in-memory document object model (DOM). This feature enables random access to the elements in a JSON file or string.
For Visual Basic, there are some limitations on what parts of the library you can use. For more information, see Visual Basic support.
The library is built-in as part of the shared framework for .NET Core 3.0 and later versions. The source generation feature is built-in as part of the shared framework for .NET 6 and later versions.
For framework versions earlier than .NET Core 3.0, install the System.Text.Json NuGet package. The package supports:
Важно
System.Text.Json
doesn't support the following serialization APIs that you might have used previously:
By default, System.Text.Json
gathers the metadata it needs to access properties of objects for serialization and deserialization at run time using reflection. As an alternative, System.Text.Json
can use the C# source generation feature to improve performance, reduce private memory usage, and facilitate assembly trimming, which reduces app size.
For more information, see Reflection versus source generation.
For information about security threats that were considered when designing JsonSerializer, and how they can be mitigated, see System.Text.Json
Threat Model.
The System.Text.Json
serializer was designed with thread safety in mind. Practically, this means that once locked, JsonSerializerOptions instances can be safely shared across multiple threads. JsonDocument provides an immutable, and in .NET 8 and later versions, thread-safe, DOM representation for JSON values.
Обратна връзка за .NET
.NET е проект с отворен код. Изберете връзка, за да предоставите обратна връзка:
Събитие
Създаване на интелигентни приложения
17.03, 23 ч. - 21.03, 23 ч.
Присъединете се към поредицата срещи, за да изградите мащабируеми AI решения, базирани на реални случаи на употреба с колеги разработчици и експерти.
Регистрирайте се сегаОбучение
Пътека за обучение
Access and manage data with the Azure Cosmos DB for NoSQL SDKs - Training
Access and manage data with the Azure Cosmos DB for NoSQL SDKs
Сертифициране
Microsoft Certified: Azure Cosmos DB Developer Specialty - Certifications
Write efficient queries, create indexing policies, manage, and provision resources in the SQL API and SDK with Microsoft Azure Cosmos DB.
Документация
How to serialize JSON in C# - .NET
Learn how to use the System.Text.Json namespace to serialize to JSON in .NET. Includes sample code.
How to deserialize JSON in C# - .NET
Learn how to use the System.Text.Json namespace to deserialize from JSON in .NET. Includes sample code.
Migrate from Newtonsoft.Json to System.Text.Json - .NET
Learn about the differences between Newtonsoft.Json and System.Text.Json and how to migrate to System.Text.Json.