Class JsonTextWriter
Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
Implements
Inherited Members
Namespace: Bayat.Json
Assembly: Bayat.Json.Runtime.dll
Syntax
public class JsonTextWriter : JsonWriter, IDisposable
Constructors
| Improve this Doc View SourceJsonTextWriter(TextWriter)
Creates an instance of the JsonWriter
class using the specified System.IO.TextWriter.
Declaration
public JsonTextWriter(TextWriter textWriter)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | textWriter | The |
Properties
| Improve this Doc View SourceArrayPool
Gets or sets the writer's character array pool.
Declaration
public IArrayPool<char> ArrayPool { get; set; }
Property Value
Type | Description |
---|---|
IArrayPool<System.Char> |
Indentation
Gets or sets how many IndentChars to write for each level in the hierarchy when Formatting is set to Formatting.Indented
.
Declaration
public int Indentation { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IndentChar
Gets or sets which character to use for indenting when Formatting is set to Formatting.Indented
.
Declaration
public char IndentChar { get; set; }
Property Value
Type | Description |
---|---|
System.Char |
QuoteChar
Gets or sets which character to use to quote attribute values.
Declaration
public char QuoteChar { get; set; }
Property Value
Type | Description |
---|---|
System.Char |
QuoteName
Gets or sets a value indicating whether object names will be surrounded with quotes.
Declaration
public bool QuoteName { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceClose()
Closes this stream and the underlying stream.
Declaration
public override void Close()
Overrides
| Improve this Doc View SourceFlush()
Flushes whatever is in the buffer to the underlying streams and also flushes the underlying stream.
Declaration
public override void Flush()
Overrides
| Improve this Doc View SourceOnStringEscapeHandlingChanged()
Declaration
protected override void OnStringEscapeHandlingChanged()
Overrides
| Improve this Doc View SourceWriteComment(String)
Writes out a comment
/.../
containing the specified text.
Declaration
public override void WriteComment(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Text to place inside the comment. |
Overrides
| Improve this Doc View SourceWriteEnd(JsonToken)
Writes the specified end token.
Declaration
protected override void WriteEnd(JsonToken token)
Parameters
Type | Name | Description |
---|---|---|
JsonToken | token | The end token to write. |
Overrides
| Improve this Doc View SourceWriteIndent()
Writes indent characters.
Declaration
protected override void WriteIndent()
Overrides
| Improve this Doc View SourceWriteIndentSpace()
Writes an indent space.
Declaration
protected override void WriteIndentSpace()
Overrides
| Improve this Doc View SourceWriteNull()
Writes a null value.
Declaration
public override void WriteNull()
Overrides
| Improve this Doc View SourceWritePropertyName(String)
Writes the property name of a name/value pair on a JSON object.
Declaration
public override void WritePropertyName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the property. |
Overrides
| Improve this Doc View SourceWritePropertyName(String, Boolean)
Writes the property name of a name/value pair on a JSON object.
Declaration
public override void WritePropertyName(string name, bool escape)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the property. |
System.Boolean | escape | A flag to indicate whether the text should be escaped when it is written as a JSON property name. |
Overrides
| Improve this Doc View SourceWriteRaw(String)
Writes raw JSON.
Declaration
public override void WriteRaw(string json)
Parameters
Type | Name | Description |
---|---|---|
System.String | json | The raw JSON to write. |
Overrides
| Improve this Doc View SourceWriteStartArray()
Writes the beginning of a JSON array.
Declaration
public override void WriteStartArray()
Overrides
| Improve this Doc View SourceWriteStartConstructor(String)
Writes the start of a constructor with the given name.
Declaration
public override void WriteStartConstructor(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the constructor. |
Overrides
| Improve this Doc View SourceWriteStartObject()
Writes the beginning of a JSON object.
Declaration
public override void WriteStartObject()
Overrides
| Improve this Doc View SourceWriteUndefined()
Writes an undefined value.
Declaration
public override void WriteUndefined()
Overrides
| Improve this Doc View SourceWriteValue(Boolean)
Writes a System.Boolean value.
Declaration
public override void WriteValue(bool value)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | value | The System.Boolean value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Byte)
Writes a System.Byte value.
Declaration
public override void WriteValue(byte value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte | value | The System.Byte value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Byte[])
Writes a System.Byte[] value.
Declaration
public override void WriteValue(byte[] value)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | value | The System.Byte[] value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Char)
Writes a System.Char value.
Declaration
public override void WriteValue(char value)
Parameters
Type | Name | Description |
---|---|---|
System.Char | value | The System.Char value to write. |
Overrides
| Improve this Doc View SourceWriteValue(DateTime)
Writes a System.DateTime value.
Declaration
public override void WriteValue(DateTime value)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | value | The System.DateTime value to write. |
Overrides
| Improve this Doc View SourceWriteValue(DateTimeOffset)
Writes a System.DateTimeOffset value.
Declaration
public override void WriteValue(DateTimeOffset value)
Parameters
Type | Name | Description |
---|---|---|
System.DateTimeOffset | value | The System.DateTimeOffset value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Decimal)
Writes a System.Decimal value.
Declaration
public override void WriteValue(decimal value)
Parameters
Type | Name | Description |
---|---|---|
System.Decimal | value | The System.Decimal value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Double)
Writes a System.Double value.
Declaration
public override void WriteValue(double value)
Parameters
Type | Name | Description |
---|---|---|
System.Double | value | The System.Double value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Guid)
Writes a System.Guid value.
Declaration
public override void WriteValue(Guid value)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | value | The System.Guid value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Int16)
Writes a System.Int16 value.
Declaration
public override void WriteValue(short value)
Parameters
Type | Name | Description |
---|---|---|
System.Int16 | value | The System.Int16 value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Int32)
Writes a System.Int32 value.
Declaration
public override void WriteValue(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The System.Int32 value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Int64)
Writes a System.Int64 value.
Declaration
public override void WriteValue(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The System.Int64 value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Nullable<Double>)
Writes a System.Nullable<T> value.
Declaration
public override void WriteValue(double? value)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Double> | value | The System.Nullable<T> value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Nullable<Single>)
Writes a System.Nullable<T> value.
Declaration
public override void WriteValue(float? value)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<System.Single> | value | The System.Nullable<T> value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Object)
Writes a System.Object value. An error will raised if the value cannot be written as a single JSON token.
Declaration
public override void WriteValue(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The System.Object value to write. |
Overrides
| Improve this Doc View SourceWriteValue(SByte)
Writes a System.SByte value.
Declaration
public override void WriteValue(sbyte value)
Parameters
Type | Name | Description |
---|---|---|
System.SByte | value | The System.SByte value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Single)
Writes a System.Single value.
Declaration
public override void WriteValue(float value)
Parameters
Type | Name | Description |
---|---|---|
System.Single | value | The System.Single value to write. |
Overrides
| Improve this Doc View SourceWriteValue(String)
Writes a System.String value.
Declaration
public override void WriteValue(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The System.String value to write. |
Overrides
| Improve this Doc View SourceWriteValue(TimeSpan)
Writes a System.TimeSpan value.
Declaration
public override void WriteValue(TimeSpan value)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | value | The System.TimeSpan value to write. |
Overrides
| Improve this Doc View SourceWriteValue(UInt16)
Writes a System.UInt16 value.
Declaration
public override void WriteValue(ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The System.UInt16 value to write. |
Overrides
| Improve this Doc View SourceWriteValue(UInt32)
Writes a System.UInt32 value.
Declaration
public override void WriteValue(uint value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | value | The System.UInt32 value to write. |
Overrides
| Improve this Doc View SourceWriteValue(UInt64)
Writes a System.UInt64 value.
Declaration
public override void WriteValue(ulong value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt64 | value | The System.UInt64 value to write. |
Overrides
| Improve this Doc View SourceWriteValue(Uri)
Writes a System.Uri value.
Declaration
public override void WriteValue(Uri value)
Parameters
Type | Name | Description |
---|---|---|
System.Uri | value | The System.Uri value to write. |
Overrides
| Improve this Doc View SourceWriteValueDelimiter()
Writes the JSON value delimiter.
Declaration
protected override void WriteValueDelimiter()
Overrides
| Improve this Doc View SourceWriteWhitespace(String)
Writes out the given white space.
Declaration
public override void WriteWhitespace(string ws)
Parameters
Type | Name | Description |
---|---|---|
System.String | ws | The string of white space characters. |