Class JsonValidatingReader
- Namespace
- Newtonsoft.Json
- Assembly
- Newtonsoft.Json.dll
Represents a reader that provides JsonSchema validation.
public class JsonValidatingReader : JsonReader, IDisposable, IJsonLineInfo
- Inheritance
-
JsonValidatingReader
- Implements
- Inherited Members
Constructors
JsonValidatingReader(JsonReader)
Initializes a new instance of the JsonValidatingReader class that validates the content returned from the given JsonReader.
public JsonValidatingReader(JsonReader reader)
Parameters
reader
JsonReaderThe JsonReader to read from while validating.
Properties
Depth
Gets the depth of the current token in the JSON document.
public override int Depth { get; }
Property Value
- int
The depth of the current token in the JSON document.
QuoteChar
Gets the quotation mark character used to enclose the value of a string.
public override char QuoteChar { get; protected set; }
Property Value
Reader
Gets the JsonReader used to construct this JsonValidatingReader.
public JsonReader Reader { get; }
Property Value
- JsonReader
The JsonReader specified in the constructor.
Schema
Gets or sets the schema.
public JsonSchema Schema { get; set; }
Property Value
- JsonSchema
The schema.
TokenType
Gets the type of the current Json token.
public override JsonToken TokenType { get; }
Property Value
Value
Gets the text value of the current Json token.
public override object Value { get; }
Property Value
ValueType
Gets the Common Language Runtime (CLR) type for the current Json token.
public override Type ValueType { get; }
Property Value
Methods
Read()
Reads the next JSON token from the stream.
public override bool Read()
Returns
- bool
true if the next token was read successfully; false if there are no more tokens to read.
ReadAsBytes()
Reads the next JSON token from the stream as a Byte[].
public override byte[] ReadAsBytes()
Returns
- byte[]
A Byte[] or a null reference if the next JSON token is null.
ReadAsDateTimeOffset()
Reads the next JSON token from the stream as a Nullable<T>.
public override DateTimeOffset? ReadAsDateTimeOffset()
Returns
ReadAsDecimal()
Reads the next JSON token from the stream as a Nullable<T>.
public override decimal? ReadAsDecimal()
Returns
- decimal?
A Nullable<T>.
ReadAsInt32()
Reads the next JSON token from the stream as a Nullable<T>.
public override int? ReadAsInt32()
Returns
- int?
A Nullable<T>.
Events
ValidationEventHandler
Sets an event handler for receiving schema validation errors.
public event ValidationEventHandler ValidationEventHandler