Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Text.​Json.​JsonDocument

Assembly: System.Text.Json

Inheritance: object → JsonDocument

Implemented Interfaces

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

Properties

public JsonElement
RootElement
Gets the root element of this JSON document.

Methods

public void
Dispose​()
Releases the resources used by this <see cref="T:System.Text.Json.JsonDocument" /> instance.
public static JsonDocument
Parse​(Buffers.​ReadOnlySequence<​byte> utf8Json, JsonDocumentOptions options = null)
Parses a sequence as UTF-8-encoded text representing a single JSON value into a JsonDocument.
Returns A JsonDocument representation of the JSON value.
utf8Json The JSON text to parse.
options Options to control the reader behavior during parsing.
public static JsonDocument
Parse​(IO.​Stream utf8Json, JsonDocumentOptions options = null)
Parses a <see cref="T:System.IO.Stream" /> as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.
Returns A JsonDocument representation of the JSON value.
utf8Json The JSON data to parse.
options Options to control the reader behavior during parsing.
public static JsonDocument
Parse​(ReadOnlyMemory<​byte> utf8Json, JsonDocumentOptions options = null)
Parses memory as UTF-8-encoded text representing a single JSON value into a JsonDocument.
Returns A JsonDocument representation of the JSON value.
utf8Json The JSON text to parse.
options Options to control the reader behavior during parsing.
public static JsonDocument
Parse​(ReadOnlyMemory<​char> json, JsonDocumentOptions options = null)
Parses text representing a single JSON value into a JsonDocument.
Returns A JsonDocument representation of the JSON value.
json The JSON text to parse.
options Options to control the reader behavior during parsing.
public static JsonDocument
Parse​(string json, JsonDocumentOptions options = null)
Parses text representing a single JSON string value into a JsonDocument.
Returns A JsonDocument representation of the JSON value.
json The JSON text to parse.
options Options to control the reader behavior during parsing.
ParseAsync​(IO.​Stream utf8Json, JsonDocumentOptions options = null, Threading.​CancellationToken cancellationToken = null)
Parses a <see cref="T:System.IO.Stream" /> as UTF-8-encoded data representing a single JSON value into a JsonDocument. The stream is read to completion.
Returns A task to produce a JsonDocument representation of the JSON value.
utf8Json The JSON data to parse.
options Options to control the reader behavior during parsing.
cancellationToken The token to monitor for cancellation requests.
public static JsonDocument
ParseValue​(Utf8JsonReader& reader)
public static bool
TryParseValue​(Utf8JsonReader& reader, JsonDocument& document)
public void
WriteTo​(Utf8JsonWriter writer)
Writes the document to the provided writer as a JSON value.
writer The writer to which to write the document.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object