@technobuddha > library > JSON > Serialization
Function: replacer()
ts
function replacer(
this: Record<string, unknown>,
key: string,
value: unknown): unknown;Defined in: replacer.ts:13
Used with JSON.stringify to encode a wider range of objects into strings that can later be decoded with reviver
Parameters
| Parameter | Type | Description |
|---|---|---|
this | Record<string, unknown> | The raw object being stringified |
key | string | The key for the field |
value | unknown | The value (may have already been encoded into a string) |
Returns
unknown
the encoded value
Remarks
Will encode Date, RegExp and BigInt objects. The numeric values 'Infinity' and 'NaN' are also encoded.