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.​JsonValidatingReader
Assembly: Newtonsoft.Json
Inheritance: object → JsonReader → JsonValidatingReader
Implemented Interfaces
- System.​IDisposable Implemented by: JsonReader
- IJsonLineInfo
<para> Represents a reader that provides <see cref="T:Newtonsoft.Json.Schema.JsonSchema" /> validation. </para> <note type="caution"> JSON Schema validation has been moved to its own package. See <see href="http://www.newtonsoft.com/jsonschema">http://www.newtonsoft.com/jsonschema</see> for more details. </note>
Properties
public
object
Value
Gets the text value of the current JSON token.
public
int
Depth
Gets the depth of the current token in the JSON document.
public
string
Path
Gets the path of the current JSON token.
public
char
QuoteChar
Gets the quotation mark character used to enclose the value of a string.
public
JsonToken
TokenType
Gets the type of the current JSON token.
public
System.​Type
ValueType
Gets the .NET type for the current JSON token.
public
JsonSchema
Schema
Gets or sets the schema.
public
JsonReader
Reader
Gets the <see cref="T:Newtonsoft.Json.JsonReader" /> used to construct this <see cref="T:Newtonsoft.Json.JsonValidatingReader" /> .
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
DateTimeZoneHandling
DateTimeZoneHandling
Gets or sets how <see cref="T:System.DateTime" /> time zones are handled when reading JSON.
public
DateParseHandling
DateParseHandling
Gets or sets how date formatted strings, e.g. "\/Date(1198908717056)\/" and "2012-03-21T05:40Z", are parsed when reading JSON.
public
FloatParseHandling
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" /> .
Gets or sets the culture used when reading JSON. Defaults to <see cref="P:System.Globalization.CultureInfo.InvariantCulture" /> .
Methods
public
void
Close​()
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 underlying <see cref="T:Newtonsoft.Json.JsonReader" /> is also closed.
public
int?
ReadAsInt32​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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" /> .
public
byte[]
ReadAsBytes​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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.
public
decimal?
ReadAsDecimal​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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" /> .
public
double?
ReadAsDouble​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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" /> .
public
bool?
ReadAsBoolean​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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" /> .
public
string
ReadAsString​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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
System.​DateTime?
ReadAsDateTime​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> 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" /> .
public
bool
Read​()
Reads the next JSON token from the underlying <see cref="T:Newtonsoft.Json.JsonReader" /> .
Returns <c>true</c> if the next token was read successfully; <c>false</c> if there are no more tokens to read.
public
System.​Threading.​Tasks.​Task<​bool>
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.
public
System.​Threading.​Tasks.​Task<​bool?>
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.
public
System.​Threading.​Tasks.​Task<​byte[]>
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.
public
System.​Threading.​Tasks.​Task<​System.​DateTime?>
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.
public
System.​Threading.​Tasks.​Task<​System.​DateTimeOffset?>
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.
public
System.​Threading.​Tasks.​Task<​decimal?>
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.
public
System.​Threading.​Tasks.​Task<​double?>
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.
public
System.​Threading.​Tasks.​Task<​int?>
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.
public
System.​Threading.​Tasks.​Task<​string>
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
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
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object