JSON serialization and deserialization (marshalling and unmarshalling) in .NET - overview

The System.Text.Json namespace provides functionality for serializing to and deserializing from JavaScript Object Notation (JSON).

The 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 read-only access of the elements in a JSON file or string.

How to get the library

  • The library is built-in as part of the .NET Core 3.0 shared framework.
  • For other target frameworks, install the System.Text.Json NuGet package. The package supports:
    • .NET Standard 2.0 and later versions
    • .NET Framework 4.7.2 and later versions
    • .NET Core 2.0, 2.1, and 2.2

Additional resources