Table of Contents

TJsonSerializer.Write Method

Overloads

TJsonSerializer.Write(TValue)

Serializes a TValue to a JSON string.

Syntax

Unit: Bcl.Json.Serializer

function TJsonSerializer.Write(const Value: TValue): string; overload;

Parameters

<-> Parameter Type Description
const Value TValue The value to serialize.

Returns

A JSON string representation of the value.

See also

TJsonSerializer.Write(TValue, TStream)

Serializes a TValue and writes the JSON output to a stream.

Syntax

Unit: Bcl.Json.Serializer

procedure TJsonSerializer.Write(const Value: TValue; Stream: TStream); overload;

Parameters

<-> Parameter Type Description
const Value TValue The value to serialize.
Stream TStream The target stream to write the JSON output to.

See also

TJsonSerializer.Write(TValue, TJsonWriter)

Serializes a TValue using the specified JSON writer.

Syntax

Unit: Bcl.Json.Serializer

procedure TJsonSerializer.Write(const Value: TValue; Writer: TJsonWriter); overload;

Parameters

<-> Parameter Type Description
const Value TValue The value to serialize.
Writer TJsonWriter The TJsonWriter to use for JSON output.

See also

TJsonSerializer.Write(TValue, TTypeToken)

Serializes a TValue to a JSON string using an explicit type token.

Syntax

Unit: Bcl.Json.Serializer

function TJsonSerializer.Write(const Value: TValue; const TypeToken: TTypeToken): string; overload;

Parameters

<-> Parameter Type Description
const Value TValue The value to serialize.
const TypeToken TTypeToken The TTypeToken that identifies the type to use for converter lookup.

Returns

A JSON string representation of the value.

See also

TJsonSerializer.Write(TValue, TTypeToken, TStream)

Serializes a TValue and writes the JSON output to a stream using an explicit type token.

Syntax

Unit: Bcl.Json.Serializer

procedure TJsonSerializer.Write(const Value: TValue; const TypeToken: TTypeToken; Stream: TStream); overload;

Parameters

<-> Parameter Type Description
const Value TValue The value to serialize.
const TypeToken TTypeToken The TTypeToken that identifies the type to use for converter lookup.
Stream TStream The target stream to write the JSON output to.

See also

TJsonSerializer.Write(TValue, TTypeToken, TJsonWriter)

Serializes a TValue using the specified JSON writer and an explicit type token.

Remarks

This is the core serialization method. All other Write overloads ultimately delegate to this method. If TypeToken has no type info, the runtime type of Value is used instead. If no type info is available at all, a JSON null is written.

Syntax

Unit: Bcl.Json.Serializer

procedure TJsonSerializer.Write(const Value: TValue; const TypeToken: TTypeToken; Writer: TJsonWriter); overload;

Parameters

<-> Parameter Type Description
const Value TValue The value to serialize.
const TypeToken TTypeToken The TTypeToken that identifies the type to use for converter lookup.
Writer TJsonWriter The TJsonWriter to use for JSON output.

See also