Skip to main content

index/functions/serialize.md

serialize(value): string

GalaChain's deterministic JSON: object keys sorted (UTF-16 code-unit order) at every depth, no whitespace, undefined/function members dropped, toJSON() honored. Byte-identical to serialize from @gala-chain/api / json-stringify-deterministic for every JSON-shaped value, which is all a DTO ever is.

Parameters​

ParameterType
valueunknown

Returns​

string

Throws​

TypeError for circular structures and BigInt values (as JSON.stringify does) and when the value itself has no JSON representation (undefined, a function, a symbol).