Click or drag to resize
Json.NET

JsonTextWriter Class

 
Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
Inheritance Hierarchy

Namespace:  Newtonsoft.Json
Assembly:  Newtonsoft.Json (in Newtonsoft.Json.dll) Version: 12.0.1+509643a8952ce731e0207710c429ad6e67dc43db
Syntax
C#
public class JsonTextWriter : JsonWriter

The JsonTextWriter type exposes the following members.

Constructors
  NameDescription
Public methodJsonTextWriter
Initializes a new instance of the JsonTextWriter class using the specified TextWriter.
Top
Properties
  NameDescription
Public propertyArrayPool
Gets or sets the writer's character array pool.
Public propertyAutoCompleteOnClose
Gets or sets a value indicating whether the JSON should be auto-completed when this writer is closed.
(Inherited from JsonWriter.)
Public propertyCloseOutput
Gets or sets a value indicating whether the destination should be closed when this writer is closed.
(Inherited from JsonWriter.)
Public propertyCulture
Gets or sets the culture used when writing JSON. Defaults to InvariantCulture.
(Inherited from JsonWriter.)
Public propertyDateFormatHandling
Gets or sets how dates are written to JSON text.
(Inherited from JsonWriter.)
Public propertyDateFormatString
Gets or sets how DateTime and DateTimeOffset values are formatted when writing JSON text.
(Inherited from JsonWriter.)
Public propertyDateTimeZoneHandling
Gets or sets how DateTime time zones are handled when writing JSON text.
(Inherited from JsonWriter.)
Public propertyFloatFormatHandling
Gets or sets how special floating point numbers, e.g. NaN, PositiveInfinity and NegativeInfinity, are written to JSON text.
(Inherited from JsonWriter.)
Public propertyFormatting
Gets or sets a value indicating how JSON text output should be formatted.
(Inherited from JsonWriter.)
Public propertyIndentation
Gets or sets how many IndentChars to write for each level in the hierarchy when Formatting is set to Indented.
Public propertyIndentChar
Gets or sets which character to use for indenting when Formatting is set to Indented.
Public propertyPath
Gets the path of the writer.
(Inherited from JsonWriter.)
Public propertyQuoteChar
Gets or sets which character to use to quote attribute values.
Public propertyQuoteName
Gets or sets a value indicating whether object names will be surrounded with quotes.
Public propertyStringEscapeHandling
Gets or sets how strings are escaped when writing JSON text.
(Inherited from JsonWriter.)
Protected propertyTop
Gets the top.
(Inherited from JsonWriter.)
Public propertyWriteState
Gets the state of the writer.
(Inherited from JsonWriter.)
Top
Methods
  NameDescription
Public methodClose
Closes this writer. If CloseOutput is set to true, the underlying TextWriter is also closed. If AutoCompleteOnClose is set to true, the JSON is auto-completed.
(Overrides JsonWriterClose.)
Public methodCloseAsync
Asynchronously closes this writer. If CloseOutput is set to true, the destination is also closed.
(Overrides JsonWriterCloseAsync(CancellationToken).)
Protected methodDispose
Releases unmanaged and - optionally - managed resources.
(Inherited from JsonWriter.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFlush
Flushes whatever is in the buffer to the underlying TextWriter and also flushes the underlying TextWriter.
(Overrides JsonWriterFlush.)
Public methodFlushAsync
Asynchronously flushes whatever is in the buffer to the destination and also flushes the destination.
(Overrides JsonWriterFlushAsync(CancellationToken).)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodSetWriteState
Sets the state of the JsonWriter.
(Inherited from JsonWriter.)
Protected methodSetWriteStateAsync
Asynchronously ets the state of the JsonWriter.
(Inherited from JsonWriter.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodWriteComment
Writes a comment /*...*/ containing the specified text.
(Overrides JsonWriterWriteComment(String).)
Public methodWriteCommentAsync
Asynchronously writes a comment /*...*/ containing the specified text.
(Overrides JsonWriterWriteCommentAsync(String, CancellationToken).)
Public methodWriteEnd
Writes the end of the current JSON object or array.
(Inherited from JsonWriter.)
Protected methodWriteEnd(JsonToken)
Writes the specified end token.
(Overrides JsonWriterWriteEnd(JsonToken).)
Public methodWriteEndArray
Writes the end of an array.
(Inherited from JsonWriter.)
Public methodWriteEndArrayAsync
Asynchronously writes the end of an array.
(Overrides JsonWriterWriteEndArrayAsync(CancellationToken).)
Public methodWriteEndAsync(CancellationToken)
Asynchronously writes the end of the current JSON object or array.
(Overrides JsonWriterWriteEndAsync(CancellationToken).)
Protected methodWriteEndAsync(JsonToken, CancellationToken)
Asynchronously writes the specified end token.
(Overrides JsonWriterWriteEndAsync(JsonToken, CancellationToken).)
Public methodWriteEndConstructor
Writes the end constructor.
(Inherited from JsonWriter.)
Public methodWriteEndConstructorAsync
Asynchronously writes the end of a constructor.
(Overrides JsonWriterWriteEndConstructorAsync(CancellationToken).)
Public methodWriteEndObject
Writes the end of a JSON object.
(Inherited from JsonWriter.)
Public methodWriteEndObjectAsync
Asynchronously writes the end of a JSON object.
(Overrides JsonWriterWriteEndObjectAsync(CancellationToken).)
Protected methodWriteIndent
Writes indent characters.
(Overrides JsonWriterWriteIndent.)
Protected methodWriteIndentAsync
Asynchronously writes indent characters.
(Overrides JsonWriterWriteIndentAsync(CancellationToken).)
Protected methodWriteIndentSpace
Writes an indent space.
(Overrides JsonWriterWriteIndentSpace.)
Protected methodWriteIndentSpaceAsync
Asynchronously writes an indent space.
(Overrides JsonWriterWriteIndentSpaceAsync(CancellationToken).)
Public methodWriteNull
Writes a null value.
(Overrides JsonWriterWriteNull.)
Public methodWriteNullAsync
Asynchronously writes a null value.
(Overrides JsonWriterWriteNullAsync(CancellationToken).)
Public methodWritePropertyName(String)
Writes the property name of a name/value pair on a JSON object.
(Overrides JsonWriterWritePropertyName(String).)
Public methodWritePropertyName(String, Boolean)
Writes the property name of a name/value pair on a JSON object.
(Overrides JsonWriterWritePropertyName(String, Boolean).)
Public methodWritePropertyNameAsync(String, CancellationToken)
Asynchronously writes the property name of a name/value pair of a JSON object.
(Overrides JsonWriterWritePropertyNameAsync(String, CancellationToken).)
Public methodWritePropertyNameAsync(String, Boolean, CancellationToken)
Asynchronously writes the property name of a name/value pair of a JSON object.
(Overrides JsonWriterWritePropertyNameAsync(String, Boolean, CancellationToken).)
Public methodWriteRaw
Writes raw JSON.
(Overrides JsonWriterWriteRaw(String).)
Public methodWriteRawAsync
Asynchronously writes raw JSON without changing the writer's state.
(Overrides JsonWriterWriteRawAsync(String, CancellationToken).)
Public methodWriteRawValue
Writes raw JSON where a value is expected and updates the writer's state.
(Inherited from JsonWriter.)
Public methodWriteRawValueAsync
Asynchronously writes raw JSON where a value is expected and updates the writer's state.
(Overrides JsonWriterWriteRawValueAsync(String, CancellationToken).)
Public methodWriteStartArray
Writes the beginning of a JSON array.
(Overrides JsonWriterWriteStartArray.)
Public methodWriteStartArrayAsync
Asynchronously writes the beginning of a JSON array.
(Overrides JsonWriterWriteStartArrayAsync(CancellationToken).)
Public methodWriteStartConstructor
Writes the start of a constructor with the given name.
(Overrides JsonWriterWriteStartConstructor(String).)
Public methodWriteStartConstructorAsync
Asynchronously writes the start of a constructor with the given name.
(Overrides JsonWriterWriteStartConstructorAsync(String, CancellationToken).)
Public methodWriteStartObject
Writes the beginning of a JSON object.
(Overrides JsonWriterWriteStartObject.)
Public methodWriteStartObjectAsync
Asynchronously writes the beginning of a JSON object.
(Overrides JsonWriterWriteStartObjectAsync(CancellationToken).)
Public methodWriteToken(JsonReader)
Writes the current JsonReader token and its children.
(Inherited from JsonWriter.)
Public methodWriteToken(JsonToken)
Writes the JsonToken token.
(Inherited from JsonWriter.)
Public methodWriteToken(JsonReader, Boolean)
Writes the current JsonReader token.
(Inherited from JsonWriter.)
Public methodWriteToken(JsonToken, Object)
Writes the JsonToken token and its value.
(Inherited from JsonWriter.)
Public methodWriteTokenAsync(JsonReader, CancellationToken)
Asynchronously writes the current JsonReader token.
(Inherited from JsonWriter.)
Public methodWriteTokenAsync(JsonToken, CancellationToken)
Asynchronously writes the JsonToken token and its value.
(Inherited from JsonWriter.)
Public methodWriteTokenAsync(JsonReader, Boolean, CancellationToken)
Asynchronously writes the current JsonReader token.
(Inherited from JsonWriter.)
Public methodWriteTokenAsync(JsonToken, Object, CancellationToken)
Asynchronously writes the JsonToken token and its value.
(Inherited from JsonWriter.)
Public methodWriteUndefined
Writes an undefined value.
(Overrides JsonWriterWriteUndefined.)
Public methodWriteUndefinedAsync
Asynchronously writes an undefined value.
(Overrides JsonWriterWriteUndefinedAsync(CancellationToken).)
Public methodWriteValue(Boolean)
Writes a Boolean value.
(Overrides JsonWriterWriteValue(Boolean).)
Public methodWriteValue(Byte)
Writes a Byte value.
(Overrides JsonWriterWriteValue(Byte).)
Public methodWriteValue(Byte)
Writes a Byte[] value.
(Overrides JsonWriterWriteValue(Byte).)
Public methodWriteValue(Char)
Writes a Char value.
(Overrides JsonWriterWriteValue(Char).)
Public methodWriteValue(DateTime)
Writes a DateTime value.
(Overrides JsonWriterWriteValue(DateTime).)
Public methodWriteValue(DateTimeOffset)
Writes a DateTimeOffset value.
(Overrides JsonWriterWriteValue(DateTimeOffset).)
Public methodWriteValue(Decimal)
Writes a Decimal value.
(Overrides JsonWriterWriteValue(Decimal).)
Public methodWriteValue(Double)
Writes a Double value.
(Overrides JsonWriterWriteValue(Double).)
Public methodWriteValue(Guid)
Writes a Guid value.
(Overrides JsonWriterWriteValue(Guid).)
Public methodWriteValue(Int16)
Writes a Int16 value.
(Overrides JsonWriterWriteValue(Int16).)
Public methodWriteValue(Int32)
Writes a Int32 value.
(Overrides JsonWriterWriteValue(Int32).)
Public methodWriteValue(Int64)
Writes a Int64 value.
(Overrides JsonWriterWriteValue(Int64).)
Public methodWriteValue(NullableDouble) (Overrides JsonWriterWriteValue(NullableDouble).)
Public methodWriteValue(NullableSingle) (Overrides JsonWriterWriteValue(NullableSingle).)
Public methodWriteValue(Object)
Writes a Object value. An error will raised if the value cannot be written as a single JSON token.
(Overrides JsonWriterWriteValue(Object).)
Public methodWriteValue(SByte)
Writes a SByte value.
(Overrides JsonWriterWriteValue(SByte).)
Public methodWriteValue(Single)
Writes a Single value.
(Overrides JsonWriterWriteValue(Single).)
Public methodWriteValue(String)
Writes a String value.
(Overrides JsonWriterWriteValue(String).)
Public methodWriteValue(TimeSpan)
Writes a TimeSpan value.
(Overrides JsonWriterWriteValue(TimeSpan).)
Public methodWriteValue(UInt16)
Writes a UInt16 value.
(Overrides JsonWriterWriteValue(UInt16).)
Public methodWriteValue(UInt32)
Writes a UInt32 value.
(Overrides JsonWriterWriteValue(UInt32).)
Public methodWriteValue(UInt64)
Writes a UInt64 value.
(Overrides JsonWriterWriteValue(UInt64).)
Public methodWriteValue(Uri)
Writes a Uri value.
(Overrides JsonWriterWriteValue(Uri).)
Public methodWriteValue(NullableBoolean) (Inherited from JsonWriter.)
Public methodWriteValue(NullableByte) (Inherited from JsonWriter.)
Public methodWriteValue(NullableChar) (Inherited from JsonWriter.)
Public methodWriteValue(NullableDateTime) (Inherited from JsonWriter.)
Public methodWriteValue(NullableDateTimeOffset) (Inherited from JsonWriter.)
Public methodWriteValue(NullableDecimal) (Inherited from JsonWriter.)
Public methodWriteValue(NullableGuid) (Inherited from JsonWriter.)
Public methodWriteValue(NullableInt16) (Inherited from JsonWriter.)
Public methodWriteValue(NullableInt32) (Inherited from JsonWriter.)
Public methodWriteValue(NullableInt64) (Inherited from JsonWriter.)
Public methodWriteValue(NullableSByte) (Inherited from JsonWriter.)
Public methodWriteValue(NullableTimeSpan) (Inherited from JsonWriter.)
Public methodWriteValue(NullableUInt16) (Inherited from JsonWriter.)
Public methodWriteValue(NullableUInt32) (Inherited from JsonWriter.)
Public methodWriteValue(NullableUInt64) (Inherited from JsonWriter.)
Public methodWriteValueAsync(Boolean, CancellationToken) (Overrides JsonWriterWriteValueAsync(Boolean, CancellationToken).)
Public methodWriteValueAsync(Byte, CancellationToken)
Asynchronously writes a Byte value.
(Overrides JsonWriterWriteValueAsync(Byte, CancellationToken).)
Public methodWriteValueAsync(Byte, CancellationToken)
Asynchronously writes a Byte[] value.
(Overrides JsonWriterWriteValueAsync(Byte, CancellationToken).)
Public methodWriteValueAsync(Char, CancellationToken)
Asynchronously writes a Char value.
(Overrides JsonWriterWriteValueAsync(Char, CancellationToken).)
Public methodWriteValueAsync(DateTime, CancellationToken)
Asynchronously writes a DateTime value.
(Overrides JsonWriterWriteValueAsync(DateTime, CancellationToken).)
Public methodWriteValueAsync(DateTimeOffset, CancellationToken)
Asynchronously writes a DateTimeOffset value.
(Overrides JsonWriterWriteValueAsync(DateTimeOffset, CancellationToken).)
Public methodWriteValueAsync(Decimal, CancellationToken)
Asynchronously writes a Decimal value.
(Overrides JsonWriterWriteValueAsync(Decimal, CancellationToken).)
Public methodWriteValueAsync(Double, CancellationToken)
Asynchronously writes a Double value.
(Overrides JsonWriterWriteValueAsync(Double, CancellationToken).)
Public methodWriteValueAsync(Guid, CancellationToken)
Asynchronously writes a Guid value.
(Overrides JsonWriterWriteValueAsync(Guid, CancellationToken).)
Public methodWriteValueAsync(Int16, CancellationToken)
Asynchronously writes a Int16 value.
(Overrides JsonWriterWriteValueAsync(Int16, CancellationToken).)
Public methodWriteValueAsync(Int32, CancellationToken)
Asynchronously writes a Int32 value.
(Overrides JsonWriterWriteValueAsync(Int32, CancellationToken).)
Public methodWriteValueAsync(Int64, CancellationToken)
Asynchronously writes a Int64 value.
(Overrides JsonWriterWriteValueAsync(Int64, CancellationToken).)
Public methodWriteValueAsync(NullableBoolean, CancellationToken)
Asynchronously writes a Boolean value.
(Overrides JsonWriterWriteValueAsync(NullableBoolean, CancellationToken).)
Public methodWriteValueAsync(NullableByte, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableByte, CancellationToken).)
Public methodWriteValueAsync(NullableChar, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableChar, CancellationToken).)
Public methodWriteValueAsync(NullableDateTime, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableDateTime, CancellationToken).)
Public methodWriteValueAsync(NullableDateTimeOffset, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableDateTimeOffset, CancellationToken).)
Public methodWriteValueAsync(NullableDecimal, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableDecimal, CancellationToken).)
Public methodWriteValueAsync(NullableDouble, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableDouble, CancellationToken).)
Public methodWriteValueAsync(NullableGuid, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableGuid, CancellationToken).)
Public methodWriteValueAsync(NullableInt16, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableInt16, CancellationToken).)
Public methodWriteValueAsync(NullableInt32, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableInt32, CancellationToken).)
Public methodWriteValueAsync(NullableInt64, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableInt64, CancellationToken).)
Public methodWriteValueAsync(NullableSByte, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableSByte, CancellationToken).)
Public methodWriteValueAsync(NullableSingle, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableSingle, CancellationToken).)
Public methodWriteValueAsync(NullableTimeSpan, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableTimeSpan, CancellationToken).)
Public methodWriteValueAsync(NullableUInt16, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableUInt16, CancellationToken).)
Public methodWriteValueAsync(NullableUInt32, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableUInt32, CancellationToken).)
Public methodWriteValueAsync(NullableUInt64, CancellationToken) (Overrides JsonWriterWriteValueAsync(NullableUInt64, CancellationToken).)
Public methodWriteValueAsync(Object, CancellationToken)
Asynchronously writes a Object value.
(Overrides JsonWriterWriteValueAsync(Object, CancellationToken).)
Public methodWriteValueAsync(SByte, CancellationToken)
Asynchronously writes a SByte value.
(Overrides JsonWriterWriteValueAsync(SByte, CancellationToken).)
Public methodWriteValueAsync(Single, CancellationToken)
Asynchronously writes a Single value.
(Overrides JsonWriterWriteValueAsync(Single, CancellationToken).)
Public methodWriteValueAsync(String, CancellationToken)
Asynchronously writes a String value.
(Overrides JsonWriterWriteValueAsync(String, CancellationToken).)
Public methodWriteValueAsync(TimeSpan, CancellationToken)
Asynchronously writes a TimeSpan value.
(Overrides JsonWriterWriteValueAsync(TimeSpan, CancellationToken).)
Public methodWriteValueAsync(UInt16, CancellationToken)
Asynchronously writes a UInt16 value.
(Overrides JsonWriterWriteValueAsync(UInt16, CancellationToken).)
Public methodWriteValueAsync(UInt32, CancellationToken)
Asynchronously writes a UInt32 value.
(Overrides JsonWriterWriteValueAsync(UInt32, CancellationToken).)
Public methodWriteValueAsync(UInt64, CancellationToken)
Asynchronously writes a UInt64 value.
(Overrides JsonWriterWriteValueAsync(UInt64, CancellationToken).)
Public methodWriteValueAsync(Uri, CancellationToken)
Asynchronously writes a Uri value.
(Overrides JsonWriterWriteValueAsync(Uri, CancellationToken).)
Protected methodWriteValueDelimiter
Writes the JSON value delimiter.
(Overrides JsonWriterWriteValueDelimiter.)
Protected methodWriteValueDelimiterAsync
Asynchronously writes the JSON value delimiter.
(Overrides JsonWriterWriteValueDelimiterAsync(CancellationToken).)
Public methodWriteWhitespace
Writes the given white space.
(Overrides JsonWriterWriteWhitespace(String).)
Public methodWriteWhitespaceAsync
Asynchronously writes the given white space.
(Overrides JsonWriterWriteWhitespaceAsync(String, CancellationToken).)
Top
See Also