Class JsonReader
Represents a reader that provides fast, non-cached, forward-only access to serialized JSON data.
Inheritance
System.Object
JsonReader
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Assembly: Bayat.Json.Runtime.dll
Syntax
public abstract class JsonReader : IDisposable
Constructors
|
Improve this Doc
View Source
JsonReader()
Initializes a new instance of the JsonReader class with the specified System.IO.TextReader.
Declaration
Fields
|
Improve this Doc
View Source
_currentState
Declaration
protected JsonReader.State _currentState
Field Value
|
Improve this Doc
View Source
_dateParseHandling
Declaration
protected DateParseHandling _dateParseHandling
Field Value
|
Improve this Doc
View Source
_floatParseHandling
Declaration
protected FloatParseHandling _floatParseHandling
Field Value
|
Improve this Doc
View Source
_quoteChar
Declaration
protected char _quoteChar
Field Value
Type |
Description |
System.Char |
|
Properties
|
Improve this Doc
View Source
Gets or sets a value indicating whether the underlying stream or
System.IO.TextReader should be closed when the reader is closed.
Declaration
public bool CloseInput { get; set; }
Property Value
Type |
Description |
System.Boolean |
true to close the underlying stream or System.IO.TextReader when
the reader is closed; otherwise false. The default is true.
|
|
Improve this Doc
View Source
Culture
Gets or sets the culture used when reading JSON. Defaults to System.Globalization.CultureInfo.InvariantCulture.
Declaration
public CultureInfo Culture { get; set; }
Property Value
Type |
Description |
System.Globalization.CultureInfo |
|
|
Improve this Doc
View Source
CurrentState
Gets the current reader state.
Declaration
protected JsonReader.State CurrentState { get; }
Property Value
|
Improve this Doc
View Source
Get or set how custom date formatted strings are parsed when reading JSON.
Declaration
public string DateFormatString { get; set; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
DateParseHandling
Get or set how date formatted strings, e.g. "/Date(1198908717056)/" and "2012-03-21T05:40Z", are parsed when reading JSON.
Declaration
public DateParseHandling DateParseHandling { get; set; }
Property Value
|
Improve this Doc
View Source
DateTimeZoneHandling
Get or set how System.DateTime time zones are handling when reading JSON.
Declaration
public DateTimeZoneHandling DateTimeZoneHandling { get; set; }
Property Value
|
Improve this Doc
View Source
Depth
Gets the depth of the current token in the JSON document.
Declaration
public virtual int Depth { get; }
Property Value
Type |
Description |
System.Int32 |
The depth of the current token in the JSON document.
|
|
Improve this Doc
View Source
FloatParseHandling
Get or set how floating point numbers, e.g. 1.0 and 9.9, are parsed when reading JSON text.
Declaration
public FloatParseHandling FloatParseHandling { get; set; }
Property Value
|
Improve this Doc
View Source
MaxDepth
Gets or sets the maximum depth allowed when reading JSON. Reading past this depth will throw a JsonReaderException.
Declaration
public int? MaxDepth { get; set; }
Property Value
Type |
Description |
System.Nullable<System.Int32> |
|
|
Improve this Doc
View Source
Path
Gets the path of the current JSON token.
Declaration
public virtual string Path { get; }
Property Value
Type |
Description |
System.String |
|
|
Improve this Doc
View Source
QuoteChar
Gets the quotation mark character used to enclose the value of a string.
Declaration
public virtual char QuoteChar { get; protected set; }
Property Value
Type |
Description |
System.Char |
|
|
Improve this Doc
View Source
SupportMultipleContent
Gets or sets a value indicating whether multiple pieces of JSON content can
be read from a continuous stream without erroring.
Declaration
public bool SupportMultipleContent { get; set; }
Property Value
Type |
Description |
System.Boolean |
true to support reading multiple pieces of JSON content; otherwise false. The default is false.
|
|
Improve this Doc
View Source
TokenType
Gets the type of the current JSON token.
Declaration
public virtual JsonToken TokenType { get; }
Property Value
|
Improve this Doc
View Source
Value
Gets the text value of the current JSON token.
Declaration
public virtual object Value { get; }
Property Value
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
ValueType
Gets The Common Language Runtime (CLR) type for the current JSON token.
Declaration
public virtual Type ValueType { get; }
Property Value
Type |
Description |
System.Type |
|
Methods
|
Improve this Doc
View Source
Close()
Declaration
public virtual void Close()
|
Improve this Doc
View Source
CreateUnexpectedEndException()
Declaration
public JsonReaderException CreateUnexpectedEndException()
Returns
|
Improve this Doc
View Source
Dispose(Boolean)
Releases unmanaged and - optionally - managed resources
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type |
Name |
Description |
System.Boolean |
disposing |
true to release both managed and unmanaged resources; false to release only unmanaged resources.
|
|
Improve this Doc
View Source
GetPosition(Int32)
Declaration
public JsonPosition GetPosition(int depth)
Parameters
Type |
Name |
Description |
System.Int32 |
depth |
|
Returns
|
Improve this Doc
View Source
MoveToContent()
Declaration
public bool MoveToContent()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Read()
Reads the next JSON token from the stream.
Declaration
public abstract bool Read()
Returns
Type |
Description |
System.Boolean |
true if the next token was read successfully; false if there are no more tokens to read.
|
|
Improve this Doc
View Source
ReadAndAssert()
Declaration
public void ReadAndAssert()
|
Improve this Doc
View Source
ReadAndMoveToContent()
Declaration
public bool ReadAndMoveToContent()
Returns
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ReadArrayIntoByteArray()
Declaration
public byte[] ReadArrayIntoByteArray()
Returns
Type |
Description |
System.Byte[] |
|
|
Improve this Doc
View Source
ReadAsBoolean()
Reads the next JSON token from the stream as a System.Nullable<T>.
Declaration
public virtual bool? ReadAsBoolean()
Returns
Type |
Description |
System.Nullable<System.Boolean> |
A System.Nullable<T>. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsBytes()
Reads the next JSON token from the stream as a System.Byte[].
Declaration
public virtual byte[] ReadAsBytes()
Returns
Type |
Description |
System.Byte[] |
A System.Byte[] or a null reference if the next JSON token is null. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsDateTime()
Reads the next JSON token from the stream as a System.Nullable<T>.
Declaration
public virtual DateTime? ReadAsDateTime()
Returns
Type |
Description |
System.Nullable<System.DateTime> |
A System.Nullable<T>. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsDateTimeOffset()
Reads the next JSON token from the stream as a System.Nullable<T>.
Declaration
public virtual DateTimeOffset? ReadAsDateTimeOffset()
Returns
Type |
Description |
System.Nullable<System.DateTimeOffset> |
A System.Nullable<T>. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsDecimal()
Reads the next JSON token from the stream as a System.Nullable<T>.
Declaration
public virtual decimal? ReadAsDecimal()
Returns
Type |
Description |
System.Nullable<System.Decimal> |
A System.Nullable<T>. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsDouble()
Reads the next JSON token from the stream as a System.Nullable<T>.
Declaration
public virtual double? ReadAsDouble()
Returns
Type |
Description |
System.Nullable<System.Double> |
A System.Nullable<T>. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsInt32()
Reads the next JSON token from the stream as a System.Nullable<T>.
Declaration
public virtual int? ReadAsInt32()
Returns
Type |
Description |
System.Nullable<System.Int32> |
A System.Nullable<T>. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadAsString()
Reads the next JSON token from the stream as a System.String.
Declaration
public virtual string ReadAsString()
Returns
Type |
Description |
System.String |
A System.String. This method will return null at the end of an array.
|
|
Improve this Doc
View Source
ReadBooleanString(String)
Declaration
public bool? ReadBooleanString(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Nullable<System.Boolean> |
|
|
Improve this Doc
View Source
ReadDateTimeOffsetString(String)
Declaration
public DateTimeOffset? ReadDateTimeOffsetString(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Nullable<System.DateTimeOffset> |
|
|
Improve this Doc
View Source
ReadDateTimeString(String)
Declaration
public DateTime? ReadDateTimeString(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Nullable<System.DateTime> |
|
|
Improve this Doc
View Source
ReadDecimalString(String)
Declaration
public decimal? ReadDecimalString(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Nullable<System.Decimal> |
|
|
Improve this Doc
View Source
ReadDoubleString(String)
Declaration
public double? ReadDoubleString(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Nullable<System.Double> |
|
|
Improve this Doc
View Source
ReaderReadAndAssert()
Declaration
public void ReaderReadAndAssert()
|
Improve this Doc
View Source
ReadInt32String(String)
Declaration
public int? ReadInt32String(string s)
Parameters
Type |
Name |
Description |
System.String |
s |
|
Returns
Type |
Description |
System.Nullable<System.Int32> |
|
|
Improve this Doc
View Source
ReadIntoWrappedTypeObject()
Declaration
public void ReadIntoWrappedTypeObject()
|
Improve this Doc
View Source
ReadProperty(Type)
Reads a property with primitive value.
Declaration
public virtual object ReadProperty(Type objectType)
Parameters
Type |
Name |
Description |
System.Type |
objectType |
|
Returns
Type |
Description |
System.Object |
|
|
Improve this Doc
View Source
ReadProperty<T>()
Reads a property with primitve value.
Declaration
public virtual T ReadProperty<T>()
Returns
Type Parameters
|
Improve this Doc
View Source
SetPostValueState(Boolean)
Declaration
public void SetPostValueState(bool updateIndex)
Parameters
Type |
Name |
Description |
System.Boolean |
updateIndex |
|
|
Improve this Doc
View Source
SetStateBasedOnCurrent()
Sets the state based on current token type.
Declaration
protected void SetStateBasedOnCurrent()
|
Improve this Doc
View Source
SetToken(JsonToken)
Declaration
protected void SetToken(JsonToken newToken)
Parameters
Type |
Name |
Description |
JsonToken |
newToken |
The new token.
|
|
Improve this Doc
View Source
SetToken(JsonToken, Object)
Sets the current token and value.
Declaration
protected void SetToken(JsonToken newToken, object value)
Parameters
Type |
Name |
Description |
JsonToken |
newToken |
The new token.
|
System.Object |
value |
The value.
|
|
Improve this Doc
View Source
SetToken(JsonToken, Object, Boolean)
Declaration
public void SetToken(JsonToken newToken, object value, bool updateIndex)
Parameters
Type |
Name |
Description |
JsonToken |
newToken |
|
System.Object |
value |
|
System.Boolean |
updateIndex |
|
|
Improve this Doc
View Source
Skip()
Skips the children of the current token.
Declaration
Explicit Interface Implementations
|
Improve this Doc
View Source
IDisposable.Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
void IDisposable.Dispose()
Implements
System.IDisposable