System.Text.Json Namespace

The System.Text.Json namespace provides high-performance, low-allocating, and standards-compliant capabilities to process JavaScript Object Notation (JSON), which includes serializing objects to JSON text and deserializing JSON text to objects, with UTF-8 support built-in. It also provides types to read and write JSON text encoded as UTF-8, and to create an in-memory document object model (DOM) for random access of the JSON elements within a structured view of the data.

Classes

JsonDocument

Provides a mechanism for examining the structural content of a JSON value without automatically instantiating data values.

JsonException

Defines a custom exception object that is thrown when invalid JSON text is encountered, when the defined maximum depth is passed, or the JSON text is not compatible with the type of a property on an object.

JsonNamingPolicy

Determines the naming policy used to convert a string-based name to another format, such as a camel-casing format.

JsonSerializer

Provides functionality to serialize objects or value types to JSON and to deserialize JSON into objects or value types.

JsonSerializerOptions

Provides options to be used with JsonSerializer.

Utf8JsonWriter

Provides a high-performance API for forward-only, non-cached writing of UTF-8 encoded JSON text.

Structs

JsonDocumentOptions

Provides the ability for the user to define custom behavior when parsing JSON to create a JsonDocument.

JsonElement

Represents a specific JSON value within a JsonDocument.

JsonElement.ArrayEnumerator

Represents an enumerator for the contents of a JSON array.

JsonElement.ObjectEnumerator

Represents an enumerator for the properties of a JSON object.

JsonEncodedText

Provides methods to transform UTF-8 or UTF-16 encoded text into a form that is suitable for JSON.

JsonProperty

Represents a single property for a JSON object.

JsonReaderOptions

Provides the ability for the user to define custom behavior when reading JSON.

JsonReaderState

Defines an opaque type that holds and saves all the relevant state information, which must be provided to the Utf8JsonReader to continue reading after processing incomplete data.

JsonWriterOptions

Allows the user to define custom behavior when writing JSON using the Utf8JsonWriter.

Utf8JsonReader

Provides a high-performance API for forward-only, read-only access to UTF-8 encoded JSON text.

Enums

JsonCommentHandling

Defines how the Utf8JsonReader struct handles comments.

JsonTokenType

Defines the various JSON tokens that make up a JSON text.

JsonValueKind

Specifies the data type of a JSON value.