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 Newtonsoft.​Json.​Linq.​JTokenReader

Assembly: Newtonsoft.Json

Inheritance: object → JsonReader → JTokenReader

Implemented Interfaces

Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.

Properties

public JToken
CurrentToken
Gets the <see cref="T:Newtonsoft.Json.Linq.JToken" /> at the reader's current position.
public string
Path
Gets the path of the current JSON token.
protected State
CurrentState
Gets the current reader state.
public bool
CloseInput
Gets or sets a value indicating whether the source should be closed when this reader is closed.
public bool
SupportMultipleContent
Gets or sets a value indicating whether multiple pieces of JSON content can be read from a continuous stream without erroring.
public char
QuoteChar
Gets the quotation mark character used to enclose the value of a string.
DateTimeZoneHandling
Gets or sets how <see cref="T:System.DateTime" /> time zones are handled when reading JSON.
DateParseHandling
Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON.
FloatParseHandling
Gets or sets how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
public string
DateFormatString
Gets or sets how custom date formatted strings are parsed when reading JSON.
public int?
MaxDepth
Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a <see cref="T:Newtonsoft.Json.JsonReaderException" /> .
public JsonToken
TokenType
Gets the type of the current JSON token.
public object
Value
Gets the text value of the current JSON token.
ValueType
Gets the .NET type for the current JSON token.
public int
Depth
Gets the depth of the current token in the JSON document.
Gets or sets the culture used when reading JSON. Defaults to <see cref="P:System.Globalization.CultureInfo.InvariantCulture" /> .

Methods

public bool
Read​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.Linq.JToken" /> .
Returns <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
ReadAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source.
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
SkipAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously skips the children of the current token.
Returns A <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsBooleanAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Boolean" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Nullable`1" /> of <see cref="T:System.Boolean" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsBytesAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Byte" /> [].
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Byte" /> []. This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsDateTimeAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsDateTimeOffsetAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTimeOffset" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTimeOffset" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsDecimalAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Decimal" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Nullable`1" /> of <see cref="T:System.Decimal" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsDoubleAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Double" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Nullable`1" /> of <see cref="T:System.Double" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsInt32Async​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int32" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int32" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
ReadAsStringAsync​(System.​Threading.​CancellationToken cancellationToken = null)
Inherited from JsonReader
Asynchronously reads the next JSON token from the source as a <see cref="T:System.String" /> .
Returns A <see cref="T:System.Threading.Tasks.Task`1" /> that represents the asynchronous read. The <see cref="P:System.Threading.Tasks.Task`1.Result" /> property returns the <see cref="T:System.String" /> . This result will be <c>null</c> at the end of an array.
cancellationToken The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
Remarks The default behaviour is to execute synchronously, returning an already-completed task. Derived classes can override this behaviour for true asychronousity.
public int?
ReadAsInt32​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int32" /> .
Returns A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int32" /> . This method will return <c>null</c> at the end of an array.
public string
ReadAsString​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.String" /> .
Returns A <see cref="T:System.String" /> . This method will return <c>null</c> at the end of an array.
public byte[]
ReadAsBytes​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Byte" /> [].
Returns A <see cref="T:System.Byte" /> [] or <c>null</c> if the next JSON token is null. This method will return <c>null</c> at the end of an array.
public double?
ReadAsDouble​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Double" /> .
Returns A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Double" /> . This method will return <c>null</c> at the end of an array.
public bool?
ReadAsBoolean​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Boolean" /> .
Returns A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Boolean" /> . This method will return <c>null</c> at the end of an array.
public decimal?
ReadAsDecimal​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.Decimal" /> .
Returns A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Decimal" /> . This method will return <c>null</c> at the end of an array.
ReadAsDateTime​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> .
Returns A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> . This method will return <c>null</c> at the end of an array.
ReadAsDateTimeOffset​()
Inherited from JsonReader
Reads the next JSON token from the source as a <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTimeOffset" /> .
Returns A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTimeOffset" /> . This method will return <c>null</c> at the end of an array.
public void
Skip​()
Inherited from JsonReader
Skips the children of the current token.
protected void
SetToken​(JsonToken newToken)
Inherited from JsonReader
Sets the current token.
newToken The new token.
protected void
SetToken​(JsonToken newToken, object value)
Inherited from JsonReader
Sets the current token and value.
newToken The new token.
value The value.
protected void
SetToken​(JsonToken newToken, object value, bool updateIndex)
Inherited from JsonReader
Sets the current token and value.
newToken The new token.
value The value.
updateIndex A flag indicating whether the position index inside an array should be updated.
protected void
SetStateBasedOnCurrent​()
Inherited from JsonReader
Sets the state based on current token type.
protected void
Dispose​(bool disposing)
Inherited from JsonReader
Releases unmanaged and - optionally - managed resources.
disposing <c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.
public void
Close​()
Inherited from JsonReader
Changes the reader's state to <see cref="F:Newtonsoft.Json.JsonReader.State.Closed" /> . If <see cref="P:Newtonsoft.Json.JsonReader.CloseInput" /> is set to <c>true</c> , the source is also closed.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object