Serialize
Declaring type: JsonSerializer
Module: System.Data.Json
Assembly: System.Data.dll
Source file: JsonSerializer.rvn
Overloads / Variants
Serialize
static func Serialize(output: OutputStream, value: object, options: JsonSerializerOptions) -> Task<Result<void, JsonError>>
Source file: JsonSerializer.rvn
Serializes an object or JSON node with selected formatting to a stream left open.
Parameters
| Name | Type | Description |
|---|---|---|
output |
OutputStream | Destination stream. |
value |
Object | The supported object or JSON node. |
options |
JsonSerializerOptions | Output formatting options. |
Return value
Success or a mapping, validation, quota or stream error.
Serialize
static func Serialize(output: OutputStream, value: object) -> Task<Result<void, JsonError>>
Source file: JsonSerializer.rvn
Maps an object and writes bounded UTF-8 JSON to a borrowed stream.
Parameters
| Name | Type | Description |
|---|---|---|
output |
OutputStream | Destination stream; left open without flushing. |
value |
Object | Supported scalar, typed array, built-in list/sequence/string-keyed map, reference model or existing JsonValue. |
Return value
Unit completion, a mapping error or Write retaining the stream cause.
Remarks
Mapping and complete output validation precede writing bytes. Getter effects are not rolled back; write failure may leave a prefix. Synchronous and whole-buffer. Explicit JSON node properties and array/collection elements serialize their JSON content directly. Supported collection interfaces allow matching built-in implementations; map reads construct ordinal HashMap and do not retain custom comparers. The complete mixed tree shares the document depth, size, occurrence and cycle checks; Object-typed model properties do not infer node mapping.
Serialize
static func Serialize(value: object, options: JsonSerializerOptions) -> Result<string, JsonError>
Source file: JsonSerializer.rvn
Serializes an object or JSON node using the selected output formatting.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Object | The supported object or JSON node. |
options |
JsonSerializerOptions | Output formatting options. |
Return value
JSON text or a mapping, validation or quota error.
Serialize
static func Serialize(value: object) -> Result<string, JsonError>
Source file: JsonSerializer.rvn
Serializes a scalar, typed array, supported collection or reference model.
Parameters
| Name | Type | Description |
|---|---|---|
value |
Object | String, Int32, Boolean, a typed array or supported collection of supported values, a nongeneric reference model with supported public properties, or an existing JsonValue. |
Return value
Compact JSON or a structured JSON/reflection error.
Remarks
Invokes actual getters. Development nested properties require exact declared runtime types; deeper than four container levels or cycles return LimitExceeded. Shared references are written as separate subtrees. Null property values, indexers and unsupported property types are rejected. Existing DOM values retain DOM behavior even when typed as Object. Output uses exact property names; order is not a contract. Typed arrays allow at most 31 entries, within the document-wide 32-value and 1024-byte limits. Explicit JSON node properties and array/collection elements serialize their JSON content directly. Supported collection interfaces allow matching built-in implementations; map reads construct ordinal HashMap and do not retain custom comparers. The complete mixed tree shares the document depth, size, occurrence and cycle checks; Object-typed model properties do not infer node mapping.