System.Text.Json
Namespace with 18 public types
Classes
JsonDocument
Represents the structure of a JSON value in a lightweight, read-only form.
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.
JsonSerializerOptions
Provides options to be used with .
Utf8JsonWriter
Provides a high-performance API for forward-only, non-cached writing of UTF-8 encoded JSON text.
Structures
JsonDocumentOptions
Provides the ability for the user to define custom behavior when parsing JSON to create a .
JsonElement
Represents a specific JSON value within a .
JsonEncodedText
Provides a way 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 to continue reading after processing incomplete data.
This type is required to support reentrancy when reading incomplete data, and to continue
reading once more data is available. Unlike the , which is a ref struct,
this type can survive across async/await boundaries and hence this type is required to provide
support for reading in more data asynchronously before continuing with a new instance of the .
JsonWriterOptions
Provides the ability for the user to define custom behavior when writing JSON
using the . By default, the JSON is written without
any indentation or extra white space. Also, the will
throw an exception if the user attempts to write structurally invalid JSON.
Utf8JsonReader
Provides a high-performance API for forward-only, read-only access to the UTF-8 encoded JSON text.
It processes the text sequentially with no caching and adheres strictly to the JSON RFC
by default (https://tools.ietf.org/html/rfc8259). When it encounters invalid JSON, it throws
a JsonException with basic error information like line number and byte position on the line.
Since this type is a ref struct, it does not directly support async. However, it does provide
support for reentrancy to read incomplete data, and continue reading once more data is presented.
To be able to set max depth while reading OR allow skipping comments, create an instance of
and pass that in to the reader.
Enumerations
JsonCommentHandling
This enum defines the various ways the can deal with comments.
JsonSerializerDefaults
Signifies what default options are used by .
JsonTokenType
This enum defines the various JSON tokens that make up a JSON text and is used by
the when moving from one token to the next.
The starts at 'None' by default. The 'Comment' enum value
is only ever reached in a specific mode and is not
reachable by default.
JsonValueKind
Specifies the data type of a JSON value.
Static Classes
JsonSerializer
Provides functionality to serialize objects or value types to JSON and
deserialize JSON into objects or value types.
Abstract Classes
JsonNamingPolicy
Determines the naming policy used to convert a string-based name to another format, such as a camel-casing format.