Function: stringify()
stringify(
value):Promise<string>
Defined in: index.ts:49
Convert value to JSON string with full type support.
Handles cycles, aliases, Date, RegExp, Map, Set, Error, BigInt, TypedArrays. Web API objects (Request, Response, Headers, URL) are serialized with full fidelity.
This is a convenience wrapper around preprocess() + JSON.stringify().
Note: Async for Request/Response body reading.
Parameters
value
any
Any serializable value
Returns
Promise<string>
JSON string in tuple $lmz format
Throws
TypeError if value contains symbols
Example
const obj = { name: "John", age: 30 };
obj.self = obj; // Cycle
const json = await stringify(obj);
const restored = await parse(json);
console.log(restored.self === restored); // true