Utf8JsonWriter.WriteStringValue Method

Definition

Overloads

WriteStringValue(String)

Writes a string text value (as a JSON string) as an element of a JSON array.

WriteStringValue(DateTime)

Writes a DateTime value (as a JSON string) as an element of a JSON array.

WriteStringValue(DateTimeOffset)

Writes a DateTimeOffset value (as a JSON string) as an element of a JSON array.

WriteStringValue(Guid)

Writes a Guid value (as a JSON string) as an element of a JSON array.

WriteStringValue(ReadOnlySpan<Byte>)

Writes a UTF-8 text value (as a JSON string) as an element of a JSON array.

WriteStringValue(ReadOnlySpan<Char>)

Writes a UTF-16 text value (as a JSON string) as an element of a JSON array.

WriteStringValue(JsonEncodedText)

Writes the pre-encoded text value (as a JSON string) as an element of a JSON array.

WriteStringValue(String)

Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs

Writes a string text value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(System::String ^ value);
public void WriteStringValue (string? value);
public void WriteStringValue (string value);
member this.WriteStringValue : string -> unit
Public Sub WriteStringValue (value As String)

Parameters

value
String

The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string element of a JSON array.

Exceptions

The specified value is too large.

Validation is enabled, and the write operation would produce invalid JSON.

Remarks

The value is escaped before writing.

If value is null, the JSON null value is written, as if the WriteNullValue() method was called.

Applies to

WriteStringValue(DateTime)

Source:
Utf8JsonWriter.WriteValues.DateTime.cs
Source:
Utf8JsonWriter.WriteValues.DateTime.cs
Source:
Utf8JsonWriter.WriteValues.DateTime.cs

Writes a DateTime value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(DateTime value);
public void WriteStringValue (DateTime value);
member this.WriteStringValue : DateTime -> unit
Public Sub WriteStringValue (value As DateTime)

Parameters

value
DateTime

The value to be written as a JSON string as an element of a JSON array.

Exceptions

Validation is enabled, and the operation would result in writing invalid JSON.

Remarks

This method writes the DateTime using the ISO 8601-1 extended format (see DateTime and DateTimeOffset support in System.Text.Json); for example, 2017-06-12T05:30:45.7680000.

Applies to

WriteStringValue(DateTimeOffset)

Source:
Utf8JsonWriter.WriteValues.DateTimeOffset.cs
Source:
Utf8JsonWriter.WriteValues.DateTimeOffset.cs
Source:
Utf8JsonWriter.WriteValues.DateTimeOffset.cs

Writes a DateTimeOffset value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(DateTimeOffset value);
public void WriteStringValue (DateTimeOffset value);
member this.WriteStringValue : DateTimeOffset -> unit
Public Sub WriteStringValue (value As DateTimeOffset)

Parameters

value
DateTimeOffset

The value to be written as a JSON string as an element of a JSON array.

Exceptions

Validation is enabled, and the operation would result in writing invalid JSON.

Remarks

This method writes the DateTimeOffset using the ISO 8601-1 extended format (see DateTime and DateTimeOffset support in System.Text.Json); for example, 2017-06-12T05:30:45.7680000-07:00.

Applies to

WriteStringValue(Guid)

Source:
Utf8JsonWriter.WriteValues.Guid.cs
Source:
Utf8JsonWriter.WriteValues.Guid.cs
Source:
Utf8JsonWriter.WriteValues.Guid.cs

Writes a Guid value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(Guid value);
public void WriteStringValue (Guid value);
member this.WriteStringValue : Guid -> unit
Public Sub WriteStringValue (value As Guid)

Parameters

value
Guid

The value to be written as a JSON string as an element of a JSON array.

Exceptions

Validation is enabled, and the operation would result in writing invalid JSON.

Remarks

This method writes the Guid value using the default StandardFormat (that is, 'D'), as the form: nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn.

Applies to

WriteStringValue(ReadOnlySpan<Byte>)

Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs

Writes a UTF-8 text value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(ReadOnlySpan<System::Byte> utf8Value);
public void WriteStringValue (ReadOnlySpan<byte> utf8Value);
member this.WriteStringValue : ReadOnlySpan<byte> -> unit
Public Sub WriteStringValue (utf8Value As ReadOnlySpan(Of Byte))

Parameters

utf8Value
ReadOnlySpan<Byte>

The UTF-8 encoded value to be written as a JSON string element of a JSON array.

Exceptions

The specified value is too large.

Validation is enabled, and the write operation would produce invalid JSON.

Remarks

The value is escaped before writing.

Applies to

WriteStringValue(ReadOnlySpan<Char>)

Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs

Writes a UTF-16 text value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(ReadOnlySpan<char> value);
public void WriteStringValue (ReadOnlySpan<char> value);
member this.WriteStringValue : ReadOnlySpan<char> -> unit
Public Sub WriteStringValue (value As ReadOnlySpan(Of Char))

Parameters

value
ReadOnlySpan<Char>

The UTF-16 encoded value to be written as a UTF-8 transcoded JSON string element of a JSON array.

Exceptions

The specified value is too large.

Validation is enabled, and the write operation would produce invalid JSON.

Remarks

The value is escaped before writing.

Applies to

WriteStringValue(JsonEncodedText)

Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs
Source:
Utf8JsonWriter.WriteValues.String.cs

Writes the pre-encoded text value (as a JSON string) as an element of a JSON array.

public:
 void WriteStringValue(System::Text::Json::JsonEncodedText value);
public void WriteStringValue (System.Text.Json.JsonEncodedText value);
member this.WriteStringValue : System.Text.Json.JsonEncodedText -> unit
Public Sub WriteStringValue (value As JsonEncodedText)

Parameters

value
JsonEncodedText

The JSON encoded value to be written as a UTF-8 transcoded JSON string element of a JSON array.

Exceptions

Validation is enabled, and the write operation would produce invalid JSON.

Remarks

The value should already be escaped when the instance of JsonEncodedText was created.

Applies to