Utf8JsonReader Utf8JsonReader Utf8JsonReader Utf8JsonReader Struct

Definition

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

public value class Utf8JsonReader
public struct Utf8JsonReader
type Utf8JsonReader = struct
Public Structure Utf8JsonReader
Inheritance
Utf8JsonReaderUtf8JsonReaderUtf8JsonReaderUtf8JsonReader

Remarks

Utf8JsonReader processes the text sequentially with no caching and by default adheres strictly to the JSON RFC.

When Utf8JsonReader encounters invalid JSON, it throws a JsonReaderException with basic error information like line number and byte position on the line. Since this type is a ref struct, it doesn't directly support async. However, it does provide support for reentrancy to read incomplete data and to continue reading once more data is presented. To be able to set max depth while reading OR allow skipping comments, create an instance of JsonReaderState and pass it to the reader.

Constructors

Utf8JsonReader(ReadOnlySequence<Byte>, Boolean, JsonReaderState) Utf8JsonReader(ReadOnlySequence<Byte>, Boolean, JsonReaderState) Utf8JsonReader(ReadOnlySequence<Byte>, Boolean, JsonReaderState) Utf8JsonReader(ReadOnlySequence<Byte>, Boolean, JsonReaderState)

Initializes a new instance of the Utf8JsonReader class.

Utf8JsonReader(ReadOnlySpan<Byte>, Boolean, JsonReaderState) Utf8JsonReader(ReadOnlySpan<Byte>, Boolean, JsonReaderState) Utf8JsonReader(ReadOnlySpan<Byte>, Boolean, JsonReaderState) Utf8JsonReader(ReadOnlySpan<Byte>, Boolean, JsonReaderState)

Initializes a new instance of the Utf8JsonReader class.

Properties

BytesConsumed BytesConsumed BytesConsumed BytesConsumed

Gets the total number of bytes consumed by the Utf8JsonReader so far for the current instance of the Utf8JsonReader with the given UTF-8 encoded input text.

CurrentDepth CurrentDepth CurrentDepth CurrentDepth

Gets the depth of the current token.

CurrentState CurrentState CurrentState CurrentState

Gets the current snapshot of the Utf8JsonReader state that must be captured by the caller and passed back in to the Utf8JsonReader constructor with more data.

HasValueSequence HasValueSequence HasValueSequence HasValueSequence

Gets a value that indicates which Value property to use to get the token value.

Position Position Position Position

Gets the current SequencePosition within the provided UTF-8 encoded input ReadOnlySequence<byte> or a default SequencePosition if the Utf8JsonReader struct was constructed with a ReadOnlySpan<byte>.

TokenType TokenType TokenType TokenType

Gets the type of the last processed JSON token in the UTF-8 encoded JSON text.

ValueSequence ValueSequence ValueSequence ValueSequence

Gets the value of the last processed token as a ReadOnlySpan<byte> slice of the input payload. If the JSON is provided within a ReadOnlySequence<byte> and the slice that represents the token value fits in a single segment, then ValueSpan contains the sliced value since it can be represented as a span. Otherwise, ValueSequence contains the token value.

ValueSpan ValueSpan ValueSpan ValueSpan

Gets the value of the last processed token as a ReadOnlySpan<byte> slice of the input payload. If the JSON is provided within a ReadOnlySequence<byte> and the slice that represents the token value fits in a single segment, then ValueSpan contains the sliced value since it can be represented as a span. Otherwise, the ValueSequence contains the token value.

Methods

GetBoolean() GetBoolean() GetBoolean() GetBoolean()

Reads the next JSON token value from the source as a Boolean.

GetDateTime() GetDateTime() GetDateTime() GetDateTime()
GetDateTimeOffset() GetDateTimeOffset() GetDateTimeOffset() GetDateTimeOffset()
GetDecimal() GetDecimal() GetDecimal() GetDecimal()

Reads the next JSON token value from the source and parses it to a Decimal.

GetDouble() GetDouble() GetDouble() GetDouble()

Reads the next JSON token value from the source and parses it to a Double.

GetGuid() GetGuid() GetGuid() GetGuid()
GetInt32() GetInt32() GetInt32() GetInt32()

Reads the next JSON token value from the source and parses it to an Int32.

GetInt64() GetInt64() GetInt64() GetInt64()

Reads the next JSON token value from the source and parses it to an Int64.

GetSingle() GetSingle() GetSingle() GetSingle()

Reads the next JSON token value from the source and parses it to a Single.

GetString() GetString() GetString() GetString()

Reads the next JSON token value from the source, unescaped, and transcoded as a String.

GetUInt32() GetUInt32() GetUInt32() GetUInt32()

Reads the next JSON token value from the source and parses it to a UInt32.

GetUInt64() GetUInt64() GetUInt64() GetUInt64()

Reads the next JSON token value from the source and parses it to a UInt64.

Read() Read() Read() Read()

Read the next JSON token from the input source.

TextEquals(ReadOnlySpan<Byte>) TextEquals(ReadOnlySpan<Byte>) TextEquals(ReadOnlySpan<Byte>) TextEquals(ReadOnlySpan<Byte>)
TextEquals(ReadOnlySpan<Char>) TextEquals(ReadOnlySpan<Char>) TextEquals(ReadOnlySpan<Char>) TextEquals(ReadOnlySpan<Char>)
TryGetDateTime(DateTime) TryGetDateTime(DateTime) TryGetDateTime(DateTime) TryGetDateTime(DateTime)
TryGetDateTimeOffset(DateTimeOffset) TryGetDateTimeOffset(DateTimeOffset) TryGetDateTimeOffset(DateTimeOffset) TryGetDateTimeOffset(DateTimeOffset)
TryGetDecimal(Decimal) TryGetDecimal(Decimal) TryGetDecimal(Decimal) TryGetDecimal(Decimal)

Reads the next JSON token value from the source and parses it to a Decimal.

TryGetDouble(Double) TryGetDouble(Double) TryGetDouble(Double) TryGetDouble(Double)

Reads the next JSON token value from the source and parses it to a Double.

TryGetGuid(Guid) TryGetGuid(Guid) TryGetGuid(Guid) TryGetGuid(Guid)
TryGetInt32(Int32) TryGetInt32(Int32) TryGetInt32(Int32) TryGetInt32(Int32)

Reads the next JSON token value from the source and parses it to an Int32.

TryGetInt64(Int64) TryGetInt64(Int64) TryGetInt64(Int64) TryGetInt64(Int64)

Reads the next JSON token value from the source and parses it to an Int64.

TryGetSingle(Single) TryGetSingle(Single) TryGetSingle(Single) TryGetSingle(Single)

Reads the next JSON token value from the source and parses it to a Single.

TryGetUInt32(UInt32) TryGetUInt32(UInt32) TryGetUInt32(UInt32) TryGetUInt32(UInt32)

Reads the next JSON token value from the source and parses it to a UInt32.

TryGetUInt64(UInt64) TryGetUInt64(UInt64) TryGetUInt64(UInt64) TryGetUInt64(UInt64)

Reads the next JSON token value from the source and parses it to a UInt64.

Applies to