Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Text.​Json.​Utf8JsonWriter
Assembly: System.Text.Json
Inheritance: object → Utf8JsonWriter
Implemented Interfaces
Provides a high-performance API for forward-only, non-cached writing of UTF-8 encoded JSON text.
Properties
public
long
BytesCommitted
Gets the total number of bytes committed to the output by the current instance so far.
public
int
BytesPending
Gets the number of bytes written by the <see cref="T:System.Text.Json.Utf8JsonWriter" /> so far that have not yet been flushed to the output and committed.
public
int
CurrentDepth
Gets the depth of the current token.
public
JsonWriterOptions
Options
Gets the custom behavior when writing JSON using this instance, which indicates whether to format the output while writing, whether to skip structural JSON validation, and which characters to escape.
Methods
public
void
Dispose​()
Commits any leftover JSON text that has not yet been flushed and releases all resources used by the current instance.
DisposeAsync​()
Asynchronously commits any leftover JSON text that has not yet been flushed and releases all resources used by the current instance.
Returns A task representing the asynchronous dispose operation.
public
void
Flush​()
Commits the JSON text written so far, which makes it visible to the output destination.
FlushAsync​(Threading.​CancellationToken cancellationToken = null)
Asynchronously commits the JSON text written so far, which makes it visible to the output destination.
Returns A task representing the asynchronous flush operation.
cancellationToken
The token to monitor for cancellation requests. The default value is <see cref="P:System.Threading.CancellationToken.None" /> .
public
void
Reset​()
Resets the internal state of this instance so that it can be reused.
public
void
Reset​(Buffers.​IBufferWriter<​byte> bufferWriter)
Resets the internal state of this instance so that it can be reused with a new instance of <see cref="T:System.Buffers.IBufferWriter`1" /> .
bufferWriter
The destination for writing JSON text.
public
void
Reset​(IO.​Stream utf8Json)
Resets the internal state of this instance so that it can be reused with a new instance of <see cref="T:System.IO.Stream" /> .
utf8Json
The destination for writing JSON text.
public
void
WriteBase64String​(ReadOnlySpan<​byte> utf8PropertyName,
ReadOnlySpan<​byte> bytes)
Writes the property name and raw bytes value (as a Base64 encoded JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded name of the property to write.
bytes
The binary data to write as Base64 encoded text.
public
void
WriteBase64String​(ReadOnlySpan<​char> propertyName,
ReadOnlySpan<​byte> bytes)
Writes the property name and raw bytes value (as a Base64 encoded JSON string) as part of a name/value pair of a JSON object.
propertyName
The property name of the JSON object to be transcoded and written as UTF-8.
bytes
The binary data to write as Base64 encoded text.
public
void
WriteBase64String​(string propertyName,
ReadOnlySpan<​byte> bytes)
Writes the property name and raw bytes value (as a Base64 encoded JSON string) as part of a name/value pair of a JSON object.
propertyName
The property name of the JSON object to be transcoded and written as UTF-8.
bytes
The binary data to write as Base64 encoded text.
public
void
WriteBase64String​(JsonEncodedText propertyName,
ReadOnlySpan<​byte> bytes)
Writes the pre-encoded property name and raw bytes value (as a Base64 encoded JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON-encoded name of the property to write.
bytes
The binary data to write as Base64 encoded text.
public
void
WriteBase64StringValue​(ReadOnlySpan<​byte> bytes)
Writes the raw bytes value as a Base64 encoded JSON string.
bytes
The binary data to be written as a Base64 encoded JSON string.
public
void
WriteBoolean​(ReadOnlySpan<​byte> utf8PropertyName,
bool value)
Writes a property name specified as a read-only span of bytes and a <see cref="T:System.Boolean" /> value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON literal true or false as part of the name/value pair.
public
void
WriteBoolean​(ReadOnlySpan<​char> propertyName,
bool value)
Writes a property name specified as a read-only character span and a <see cref="T:System.Boolean" /> value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON literal true or false as part of the name/value pair.
public
void
WriteBoolean​(string propertyName,
bool value)
Writes a property name specified as a string and a <see cref="T:System.Boolean" /> value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON literal true or false as part of the name/value pair.
public
void
WriteBoolean​(JsonEncodedText propertyName,
bool value)
Writes the pre-encoded property name and <see cref="T:System.Boolean" /> value (as a JSON literal true or false) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON literal true or false as part of the name/value pair.
public
void
WriteBooleanValue​(bool value)
Writes a <see cref="T:System.Boolean" /> value (as a JSON literal true or false).
value
The value to be written as a JSON literal true or false.
public
void
WriteCommentValue​(ReadOnlySpan<​byte> utf8Value)
Writes a UTF-8 text value as a JSON comment.
utf8Value
The UTF-8 encoded value to be written as a JSON comment within <c>/*..*/</c> .
public
void
WriteCommentValue​(ReadOnlySpan<​char> value)
Writes a UTF-16 text value as a JSON comment.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON comment within <c>/*..*/</c> .
public
void
WriteCommentValue​(string value)
Writes a string text value as a JSON comment.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON comment within <c>/*..*/</c> .
public
void
WriteEndArray​()
Writes the end of a JSON array.
public
void
WriteEndObject​()
Writes the end of a JSON object.
public
void
WriteNull​(ReadOnlySpan<​byte> utf8PropertyName)
Writes a property name specified as a read-only span of bytes and the JSON literal null as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
public
void
WriteNull​(ReadOnlySpan<​char> propertyName)
Writes a property name specified as a read-only character span and the JSON literal null as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteNull​(string propertyName)
Writes a property name specified as a string and the JSON literal null as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteNull​(JsonEncodedText propertyName)
Writes the pre-encoded property name and the JSON literal null as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteNullValue​()
Writes the JSON literal null.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
decimal value)
Writes a property name specified as a read-only span of bytes and a <see cref="T:System.Decimal" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
double value)
Writes a property name specified as a read-only span of bytes and a <see cref="T:System.Double" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
int value)
Writes a property name specified as a read-only span of bytes and an <see cref="T:System.Int32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
long value)
Writes a property name specified as a read-only span of bytes and an <see cref="T:System.Int64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
Single value)
Writes a property name specified as a read-only span of bytes and a <see cref="T:System.Single" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
uint value)
Writes a property name specified as a read-only span of bytes and a <see cref="T:System.UInt32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​byte> utf8PropertyName,
ulong value)
Writes a property name specified as a read-only span of bytes and a <see cref="T:System.UInt64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
decimal value)
Writes a property name specified as a read-only character span and a <see cref="T:System.Decimal" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
double value)
Writes a property name specified as a read-only character span and a <see cref="T:System.Double" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
int value)
Writes a property name specified as a read-only character span and an <see cref="T:System.Int32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
long value)
Writes a property name specified as a read-only character span and an <see cref="T:System.Int64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
Single value)
Writes a property name specified as a read-only character span and a <see cref="T:System.Single" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
uint value)
Writes a property name specified as a read-only character span and a <see cref="T:System.UInt32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(ReadOnlySpan<​char> propertyName,
ulong value)
Writes a property name specified as a read-only character span and a <see cref="T:System.UInt64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
decimal value)
Writes a property name specified as a string and a <see cref="T:System.Decimal" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
double value)
Writes a property name specified as a string and a <see cref="T:System.Double" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
int value)
Writes a property name specified as a string and an <see cref="T:System.Int32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
long value)
Writes a property name specified as a string and an <see cref="T:System.Int64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
Single value)
Writes a property name specified as a string and a <see cref="T:System.Single" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
uint value)
Writes a property name specified as a string and a <see cref="T:System.UInt32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(string propertyName,
ulong value)
Writes a property name specified as a string and a <see cref="T:System.UInt64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
decimal value)
Writes the pre-encoded property name and <see cref="T:System.Decimal" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
double value)
Writes the pre-encoded property name and <see cref="T:System.Double" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
int value)
Writes the pre-encoded property name and <see cref="T:System.Int32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
long value)
Writes the pre-encoded property name and <see cref="T:System.Int64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
Single value)
Writes the pre-encoded property name and <see cref="T:System.Single" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
uint value)
Writes the pre-encoded property name and <see cref="T:System.UInt32" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumber​(JsonEncodedText propertyName,
ulong value)
Writes the pre-encoded property name and <see cref="T:System.UInt64" /> value (as a JSON number) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON number as part of the name/value pair.
public
void
WriteNumberValue​(decimal value)
Writes a <see cref="T:System.Decimal" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WriteNumberValue​(double value)
Writes a <see cref="T:System.Double" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WriteNumberValue​(int value)
Writes an <see cref="T:System.Int32" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WriteNumberValue​(long value)
Writes an <see cref="T:System.Int64" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WriteNumberValue​(Single value)
Writes a <see cref="T:System.Single" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WriteNumberValue​(uint value)
Writes a <see cref="T:System.UInt32" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WriteNumberValue​(ulong value)
Writes a <see cref="T:System.UInt64" /> value (as a JSON number).
value
The value to be written as a JSON number.
public
void
WritePropertyName​(ReadOnlySpan<​byte> utf8PropertyName)
Writes the UTF-8 property name (as a JSON string) as the first part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
public
void
WritePropertyName​(ReadOnlySpan<​char> propertyName)
Writes the property name (as a JSON string) as the first part of a name/value pair of a JSON object.
propertyName
The property name of the JSON object to be transcoded and written as UTF-8.
public
void
WritePropertyName​(string propertyName)
Writes the property name (as a JSON string) as the first part of a name/value pair of a JSON object.
propertyName
The property name of the JSON object to be transcoded and written as UTF-8.
public
void
WritePropertyName​(JsonEncodedText propertyName)
Writes the pre-encoded property name (as a JSON string) as the first part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteRawValue​(Buffers.​ReadOnlySequence<​byte> utf8Json,
bool skipInputValidation = false)
Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
utf8Json
The raw JSON content to write.
skipInputValidation
<see langword="false" /> to validate if the input is an RFC 8259-compliant JSON payload; <see langword="true" /> to skip validation.
public
void
WriteRawValue​(ReadOnlySpan<​byte> utf8Json,
bool skipInputValidation = false)
Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
utf8Json
The raw JSON content to write.
skipInputValidation
<see langword="false" /> to validate if the input is an RFC 8259-compliant JSON payload; <see langword="true" /> otherwise.
public
void
WriteRawValue​(ReadOnlySpan<​char> json,
bool skipInputValidation = false)
Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
json
The raw JSON content to write.
skipInputValidation
<see langword="false" /> to validate if the input is an RFC 8259-compliant JSON payload; <see langword="true" /> otherwise.
public
void
WriteRawValue​(string json,
bool skipInputValidation = false)
Writes the input as JSON content. It is expected that the input content is a single complete JSON value.
json
The raw JSON content to write.
skipInputValidation
<see langword="false" /> to validate if the input is an RFC 8259-compliant JSON payload; <see langword="true" /> otherwise.
public
void
WriteStartArray​()
Writes the beginning of a JSON array.
public
void
WriteStartArray​(ReadOnlySpan<​byte> utf8PropertyName)
Writes the beginning of a JSON array with a property name specified as a read-only span of bytes as the key.
utf8PropertyName
The UTF-8 encoded property name of the JSON array to be written.
public
void
WriteStartArray​(ReadOnlySpan<​char> propertyName)
Writes the beginning of a JSON array with a property name specified as a read-only character span as the key.
propertyName
The UTF-16 encoded property name of the JSON array to be transcoded and written as UTF-8.
public
void
WriteStartArray​(string propertyName)
Writes the beginning of a JSON array with a property name specified as a string as the key.
propertyName
The UTF-16 encoded property name of the JSON array to be transcoded and written as UTF-8.
public
void
WriteStartArray​(JsonEncodedText propertyName)
Writes the beginning of a JSON array with a pre-encoded property name as the key.
propertyName
The JSON encoded property name of the JSON array to be transcoded and written as UTF-8.
public
void
WriteStartObject​()
Writes the beginning of a JSON object.
public
void
WriteStartObject​(ReadOnlySpan<​byte> utf8PropertyName)
Writes the beginning of a JSON object with a property name specified as a read-only span of bytes as the key.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
public
void
WriteStartObject​(ReadOnlySpan<​char> propertyName)
Writes the beginning of a JSON object with a property name specified as a read-only character span as the key.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteStartObject​(string propertyName)
Writes the beginning of a JSON object with a property name specified as a string as the key.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteStartObject​(JsonEncodedText propertyName)
Writes the beginning of a JSON object with a pre-encoded property name as the key.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
DateTime value)
Writes a UTF-8 property name and a <see cref="T:System.DateTime" /> value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
DateTimeOffset value)
Writes a UTF-8 property name and a <see cref="T:System.DateTimeOffset" /> value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
Guid value)
Writes a UTF-8 property name and a <see cref="T:System.Guid" /> value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
ReadOnlySpan<​byte> utf8Value)
Writes a UTF-8 property name and UTF-8 text value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
utf8Value
The UTF-8 encoded value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
ReadOnlySpan<​char> value)
Writes a UTF-8 property name and UTF-16 text value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
string value)
Writes a UTF-8 property name and string text value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​byte> utf8PropertyName,
JsonEncodedText value)
Writes the UTF-8 property name and pre-encoded value (as a JSON string) as part of a name/value pair of a JSON object.
utf8PropertyName
The UTF-8 encoded property name of the JSON object to be written.
value
The JSON encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
DateTime value)
Writes a property name specified as a read-only character span and a <see cref="T:System.DateTime" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
DateTimeOffset value)
Writes a property name specified as a read-only character span and a <see cref="T:System.DateTimeOffset" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
Guid value)
Writes a property name specified as a read-only character span and a <see cref="T:System.Guid" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
ReadOnlySpan<​byte> utf8Value)
Writes a UTF-16 property name and UTF-8 text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
utf8Value
The UTF-8 encoded value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
ReadOnlySpan<​char> value)
Writes a UTF-16 property name and UTF-16 text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
string value)
Writes a UTF-16 property name and string text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(ReadOnlySpan<​char> propertyName,
JsonEncodedText value)
Writes the property name and pre-encoded value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The property name of the JSON object to be transcoded and written as UTF-8.
value
The JSON encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
DateTime value)
Writes a property name specified as a string and a <see cref="T:System.DateTime" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
DateTimeOffset value)
Writes a property name specified as a string and a <see cref="T:System.DateTimeOffset" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
Guid value)
Writes a property name specified as a string and a <see cref="T:System.Guid" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
ReadOnlySpan<​byte> utf8Value)
Writes a property name specified as a string and a UTF-8 text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
utf8Value
The UTF-8 encoded value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
ReadOnlySpan<​char> value)
Writes a property name specified as a string and a UTF-16 text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
string value)
Writes a property name specified as a string and a string text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The UTF-16 encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(string propertyName,
JsonEncodedText value)
Writes the property name and pre-encoded value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The property name of the JSON object to be transcoded and written as UTF-8.
value
The JSON encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
DateTime value)
Writes the pre-encoded property name and <see cref="T:System.DateTime" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
DateTimeOffset value)
Writes the pre-encoded property name and <see cref="T:System.DateTimeOffset" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
Guid value)
Writes the pre-encoded property name and <see cref="T:System.Guid" /> value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
ReadOnlySpan<​byte> utf8Value)
Writes the pre-encoded property name and UTF-8 text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
utf8Value
The UTF-8 encoded value to be written as a JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
ReadOnlySpan<​char> value)
Writes the pre-encoded property name and text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
string value)
Writes the pre-encoded property name and string text value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteString​(JsonEncodedText propertyName,
JsonEncodedText value)
Writes the pre-encoded property name and pre-encoded value (as a JSON string) as part of a name/value pair of a JSON object.
propertyName
The JSON encoded property name of the JSON object to be transcoded and written as UTF-8.
value
The JSON encoded value to be written as a UTF-8 transcoded JSON string as part of the name/value pair.
public
void
WriteStringValue​(DateTime value)
Writes a <see cref="T:System.DateTime" /> value (as a JSON string).
value
The value to be written as a JSON string.
public
void
WriteStringValue​(DateTimeOffset value)
Writes a <see cref="T:System.DateTimeOffset" /> value (as a JSON string).
value
The value to be written as a JSON string.
public
void
WriteStringValue​(Guid value)
Writes a <see cref="T:System.Guid" /> value (as a JSON string).
value
The value to be written as a JSON string.
public
void
WriteStringValue​(ReadOnlySpan<​byte> utf8Value)
Writes a UTF-8 text value (as a JSON string).
utf8Value
The UTF-8 encoded value to be written as a JSON string.
public
void
WriteStringValue​(ReadOnlySpan<​char> value)
Writes a UTF-16 text value (as a JSON string).
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string.
public
void
WriteStringValue​(string value)
Writes a string text value (as a JSON string).
value
The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string.
public
void
WriteStringValue​(JsonEncodedText value)
Writes the pre-encoded text value (as a JSON string).
value
The JSON encoded value to be written as a UTF-8 transcoded JSON string.
public
void
WriteStringValueSegment​(ReadOnlySpan<​byte> value,
bool isFinalSegment)
Writes the UTF-8 text value segment as a partial JSON string.
value
The UTF-8 encoded value to be written as a JSON string element of a JSON array.
isFinalSegment
Indicates that this is the final segment of the string.
public
void
WriteStringValueSegment​(ReadOnlySpan<​char> value,
bool isFinalSegment)
Writes the text value segment as a partial JSON string.
value
The value to write.
isFinalSegment
Indicates that this is the final segment of the string.
public
void
WriteBase64StringSegment​(ReadOnlySpan<​byte> value,
bool isFinalSegment)
Writes the input bytes as a partial JSON string.
value
The bytes to be written as a JSON string element of a JSON array.
isFinalSegment
Indicates that this is the final segment of the string.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object