Share via

JsonReaderState(JsonReaderOptions) Constructor


Constructs a new JsonReaderState instance.

public JsonReaderState (System.Text.Json.JsonReaderOptions options = default);
new System.Text.Json.JsonReaderState : System.Text.Json.JsonReaderOptions -> System.Text.Json.JsonReaderState
Public Sub New (Optional options As JsonReaderOptions = Nothing)



Defines the customized behavior of the Utf8JsonReader that is different from the JSON RFC (for example how to handle comments, or the maximum depth allowed when reading). By default, the Utf8JsonReader follows the JSON RFC strictly (comments within the JSON are invalid) and reads up to a maximum depth of 64.


The maximum depth is set to a non-positive value (< 0).


An instance of this state must be passed to the Utf8JsonReader constructor with the JSON data. Unlike the Utf8JsonReader, which is a ref struct, the state 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 Utf8JsonReader.

Applies to