TJsonSerializer.WriteAs Method
Overloads
- TJsonSerializer.WriteAs(T)
- TJsonSerializer.WriteAs(T, TStream)
- TJsonSerializer.WriteAs(T, TJsonWriter)
TJsonSerializer.WriteAs(T)
Serializes a typed value to a JSON string.
Remarks
Uses compile-time type information from T to select the appropriate converter, which can produce more accurate results than relying on the runtime type of a TValue.
Syntax
Unit: Bcl.Json.Serializer
function TJsonSerializer.WriteAs(const Value: T): string; overload;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| const | Value | T | The value to serialize. |
Returns
A JSON string representation of the value.
See also
TJsonSerializer.WriteAs(T, TStream)
Serializes a typed value and writes the JSON output to a stream.
Remarks
Uses compile-time type information from T to select the appropriate converter.
Syntax
Unit: Bcl.Json.Serializer
procedure TJsonSerializer.WriteAs(const Value: T; Stream: TStream); overload;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| const | Value | T | The value to serialize. |
| Stream | TStream | The target stream to write the JSON output to. |
See also
TJsonSerializer.WriteAs(T, TJsonWriter)
Serializes a typed value using the specified JSON writer.
Remarks
Uses compile-time type information from T to select the appropriate converter.
Syntax
Unit: Bcl.Json.Serializer
procedure TJsonSerializer.WriteAs(const Value: T; Writer: TJsonWriter); overload;
Parameters
| <-> | Parameter | Type | Description |
|---|---|---|---|
| const | Value | T | The value to serialize. |
| Writer | TJsonWriter | The TJsonWriter to use for JSON output. |