JsonWriter
Represents a writer that provides a fast, non-cached, forward-only way of generating JSON data.
Gets or sets a value indicating whether the JSON should be auto-completed when this writer is closed.
Gets or sets a value indicating whether the destination should be closed when this writer is closed.
Gets or sets the culture used when writing JSON. Defaults to InvariantCulture.
Gets or sets how dates are written to JSON text.
Gets or sets how DateTime and DateTimeOffset values are formatted when writing JSON text.
Gets or sets how DateTime time zones are handled when writing JSON text.
Gets or sets how special floating point numbers, e.g. NaN,
PositiveInfinity and NegativeInfinity,
are written to JSON text.
Gets or sets a value indicating how JSON text output should be formatted.
Gets the path of the writer.
Gets or sets how strings are escaped when writing JSON text.
Gets the state of the writer.
protected JsonWriter()
Initializes a new instance of the JsonWriter class.
Closes this writer.
If CloseOutput is set to true, the destination is also closed.
If AutoCompleteOnClose is set to true, the JSON is auto-completed.
Asynchronously closes this writer.
If CloseOutput is set to true, the destination is also closed.
Releases unmanaged and - optionally - managed resources.
Flushes whatever is in the buffer to the destination and also flushes the destination.
Asynchronously flushes whatever is in the buffer to the destination and also flushes the destination.
Sets the state of the JsonWriter.
protected Task SetWriteStateAsync(JsonToken token, object value, CancellationToken cancellationToken)
Asynchronously ets the state of the JsonWriter.
Writes a comment /*...*/ containing the specified text.
Asynchronously writes a comment /*...*/ containing the specified text.
Writes the end of the current JSON object or array.
Writes the specified end token.
Writes the end of an array.
Asynchronously writes the end of an array.
Asynchronously writes the specified end token.
Asynchronously writes the end of the current JSON object or array.
Writes the end constructor.
Asynchronously writes the end of a constructor.
Writes the end of a JSON object.
Asynchronously writes the end of a JSON object.
Writes indent characters.
Asynchronously writes indent characters.
Writes an indent space.
Asynchronously writes an indent space.
Writes a null value.
Asynchronously writes a null value.
Writes the property name of a name/value pair of a JSON object.
Writes the property name of a name/value pair of a JSON object.
public virtual Task WritePropertyNameAsync(string name, CancellationToken cancellationToken = default)
Asynchronously writes the property name of a name/value pair of a JSON object.
public virtual Task WritePropertyNameAsync(string name, bool escape, CancellationToken cancellationToken = default)
Asynchronously writes the property name of a name/value pair of a JSON object.
Writes raw JSON without changing the writer's state.
Asynchronously writes raw JSON without changing the writer's state.
Writes raw JSON where a value is expected and updates the writer's state.
Asynchronously writes raw JSON where a value is expected and updates the writer's state.
Writes the beginning of a JSON array.
Asynchronously writes the beginning of a JSON array.
Writes the start of a constructor with the given name.
public virtual Task WriteStartConstructorAsync(string name, CancellationToken cancellationToken = default)
Asynchronously writes the start of a constructor with the given name.
Writes the beginning of a JSON object.
Asynchronously writes the beginning of a JSON object.
Writes the current JsonReader token and its children.
Writes the current JsonReader token.
Writes the JsonToken token and its value.
Writes the JsonToken token.
Asynchronously writes the current JsonReader token.
public Task WriteTokenAsync(JsonReader reader, bool writeChildren, CancellationToken cancellationToken = default)
Asynchronously writes the current JsonReader token.
Asynchronously writes the JsonToken token and its value.
public Task WriteTokenAsync(JsonToken token, object value, CancellationToken cancellationToken = default)
Asynchronously writes the JsonToken token and its value.
Writes an undefined value.
Asynchronously writes an undefined value.
Writes a String value.
Writes a Int32 value.
Writes a UInt32 value.
Writes a Int64 value.
Writes a UInt64 value.
Writes a Single value.
Writes a Double value.
Writes a Boolean value.
Writes a Int16 value.
Writes a UInt16 value.
Writes a Char value.
Writes a Byte value.
Writes a SByte value.
Writes a Decimal value.
Writes a DateTime value.
Writes a DateTimeOffset value.
Writes a Guid value.
Writes a TimeSpan value.
Writes a Nullable<T> of Int32 value.
Writes a Nullable<T> of UInt32 value.
Writes a Nullable<T> of Int64 value.
Writes a Nullable<T> of UInt64 value.
Writes a Nullable<T> of Single value.
Writes a Nullable<T> of Double value.
Writes a Nullable<T> of Boolean value.
Writes a Nullable<T> of Int16 value.
Writes a Nullable<T> of UInt16 value.
Writes a Nullable<T> of Char value.
Writes a Nullable<T> of Byte value.
Writes a Nullable<T> of SByte value.
Writes a Nullable<T> of Decimal value.
Writes a Nullable<T> of DateTime value.
Writes a Nullable<T> of DateTimeOffset value.
Writes a Nullable<T> of Guid value.
Writes a Nullable<T> of TimeSpan value.
Writes a Byte[] value.
Writes a Uri value.
Writes a Object value.
An error will raised if the value cannot be written as a single JSON token.
Asynchronously writes a Nullable<T> of Boolean value.
Asynchronously writes a Boolean value.
Asynchronously writes a Byte value.
Asynchronously writes a Nullable<T> of Byte value.
Asynchronously writes a Byte[] value.
Asynchronously writes a Char value.
Asynchronously writes a Nullable<T> of Char value.
Asynchronously writes a DateTime value.
Asynchronously writes a Nullable<T> of DateTime value.
public virtual Task WriteValueAsync(DateTimeOffset value, CancellationToken cancellationToken = default)
Asynchronously writes a DateTimeOffset value.
public virtual Task WriteValueAsync(DateTimeOffset? value, CancellationToken cancellationToken = default)
Asynchronously writes a Nullable<T> of DateTimeOffset value.
Asynchronously writes a Decimal value.
Asynchronously writes a Nullable<T> of Decimal value.
Asynchronously writes a Double value.
Asynchronously writes a Nullable<T> of Double value.
Asynchronously writes a Single value.
Asynchronously writes a Nullable<T> of Single value.
Asynchronously writes a Guid value.
Asynchronously writes a Nullable<T> of Guid value.
Asynchronously writes a Int32 value.
Asynchronously writes a Nullable<T> of Int32 value.
Asynchronously writes a Int64 value.
Asynchronously writes a Nullable<T> of Int64 value.
Asynchronously writes a Object value.
Asynchronously writes a SByte value.
Asynchronously writes a Nullable<T> of SByte value.
Asynchronously writes a Int16 value.
Asynchronously writes a Nullable<T> of Int16 value.
Asynchronously writes a String value.
Asynchronously writes a TimeSpan value.
Asynchronously writes a Nullable<T> of TimeSpan value.
Asynchronously writes a UInt32 value.
Asynchronously writes a Nullable<T> of UInt32 value.
Asynchronously writes a UInt64 value.
Asynchronously writes a Nullable<T> of UInt64 value.
Asynchronously writes a Uri value.
Asynchronously writes a UInt16 value.
Asynchronously writes a Nullable<T> of UInt16 value.
Writes the JSON value delimiter.
Asynchronously writes the JSON value delimiter.
Writes the given white space.
Asynchronously writes the given white space.