Pular para o conteúdo
Português (BR)

JsonSerializer

Este conteúdo não está disponível em sua língua ainda.

Defined in: src/serialization/JsonSerializer.ts:17

JSON serializer — the default fallback. Handles plain objects, arrays, strings, numbers, booleans, null, and — via the shared tagged tree walker in JsonTree.tsDate, Uint8Array, Map, Set, bigint, NaN/Infinity/-0, RegExp, URL, Error (name/message/cause, no stack), and every typed array / DataView / ArrayBuffer. toJSON() is honoured, circular references are reported as SerializationError instead of overflowing the stack, and user data that happens to look like a tag round-trips via the __literal__ escape. Class identity for custom user types is NOT preserved; the decoded value is a plain object. Callers that need stronger typing should register a custom serializer via SerializationExtension.

new JsonSerializer(): JsonSerializer

JsonSerializer

readonly id: 1 = 1

Defined in: src/serialization/JsonSerializer.ts:18

Stable identifier that is embedded in every frame. Numbers 1..99 are reserved for the actor-ts built-ins (JSON=1, CBOR=2). User-defined serializers SHOULD use IDs ≥ RESERVED_SERIALIZER_IDS_BELOW.

Serializer.id


readonly includesManifest: false = false

Defined in: src/serialization/JsonSerializer.ts:20

True when this serializer is willing to encode the given value.

Serializer.includesManifest


readonly name: "json" = 'json'

Defined in: src/serialization/JsonSerializer.ts:19

Human-readable name, surfaced in diagnostics.

Serializer.name

fromBinary(bytes, _manifest): unknown

Defined in: src/serialization/JsonSerializer.ts:36

Decode from binary. manifest is whatever was produced on the other side (or ” when the serializer does not use one).

Uint8Array

string

unknown

Serializer.fromBinary


manifest(_obj): string

Defined in: src/serialization/JsonSerializer.ts:22

Return a tag describing the concrete type of obj so the decoder knows how to reconstruct it. Typical values: class name, event ID, “map”, “null”, etc. May return an empty string for serializers that don’t need a manifest.

unknown

string

Serializer.manifest


toBinary(obj): Uint8Array

Defined in: src/serialization/JsonSerializer.ts:24

Encode to binary.

unknown

Uint8Array

Serializer.toBinary