Skip to content

Utf8JsonReader.TrySkip Method

Definition

Namespace: Corvus.Text.Json
Assembly: Corvus.Text.Json.dll
Source: Utf8JsonReader.cs

TrySkip()

Tries to skip the children of the current JSON token.

public bool TrySkip()

Returns

bool

True if there was enough data for the children to be skipped successfully, else false.

Exceptions

Exception Description
JsonException Thrown when an invalid JSON token is encountered while skipping, according to the JSON RFC, or if the current depth exceeds the recursive limit set by the max depth.

Remarks

If the reader did not have enough data to completely skip the children of the current token, it will be reset to the state it was in before the method was called. When TokenType is PropertyName, the reader first moves to the property value. When TokenType (originally, or after advancing) is StartObject or StartArray, the reader advances to the matching EndObject or EndArray. For all other token types, the reader does not move. After the next call to Read, the reader will be at the next value (when in an array), the next property name (when in an object), or the end array/object token.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue