Επεξεργασία

Κοινή χρήση μέσω


JsonDocument Class

Definition

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

public ref class JsonDocument sealed : IDisposable
public sealed class JsonDocument : IDisposable
type JsonDocument = class
    interface IDisposable
Public NotInheritable Class JsonDocument
Implements IDisposable
Inheritance
JsonDocument
Implements

Remarks

This class utilizes resources from pooled memory to minimize the impact of the garbage collector (GC) in high-usage scenarios. Failure to properly dispose this object will result in the memory not being returned to the pool, which will increase GC impact across various parts of the framework.

For more information, see How to use the JSON DOM, Utf8JsonReader, and Utf8JsonWriter in System.Text.Json.

Properties

RootElement

Gets the root element of this JSON document.

Methods

Dispose()

Releases the resources used by this JsonDocument instance.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Parse(ReadOnlyMemory<Byte>, JsonDocumentOptions)

Parses memory as UTF-8-encoded text representing a single JSON value into a JsonDocument.

Parse(ReadOnlyMemory<Char>, JsonDocumentOptions)

Parses text representing a single JSON value into a JsonDocument.

Parse(ReadOnlySequence<Byte>, JsonDocumentOptions)

Parses a sequence as UTF-8-encoded text representing a single JSON value into a JsonDocument.

Parse(Stream, JsonDocumentOptions)

Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.

Parse(String, JsonDocumentOptions)

Parses text representing a single JSON string value into a JsonDocument.

ParseAsync(Stream, JsonDocumentOptions, CancellationToken)

Parses a Stream as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.

ParseValue(Utf8JsonReader)

Parses one JSON value (including objects or arrays) from the provided reader.

ToString()

Returns a string that represents the current object.

(Inherited from Object)
TryParseValue(Utf8JsonReader, JsonDocument)

Attempts to parse one JSON value (including objects or arrays) from the provided reader.

WriteTo(Utf8JsonWriter)

Writes the document to the provided writer as a JSON value.

Extension Methods

Deserialize(JsonDocument, JsonTypeInfo)

Converts the JsonDocument representing a single JSON value into an instance specified by the jsonTypeInfo.

Deserialize(JsonDocument, Type, JsonSerializerOptions)

Converts the JsonDocument representing a single JSON value into a returnType.

Deserialize(JsonDocument, Type, JsonSerializerContext)

Converts the JsonDocument representing a single JSON value into a returnType.

Deserialize<TValue>(JsonDocument, JsonSerializerOptions)

Converts the JsonDocument representing a single JSON value into a TValue.

Deserialize<TValue>(JsonDocument, JsonTypeInfo<TValue>)

Converts the JsonDocument representing a single JSON value into a TValue.

Applies to