Skip to content

JsonKit.Serialize

github-actions[bot] edited this page Jul 30, 2023 · 1 revision

Namespace: Serialize

JsonKit.Serialize

Table of contents

Functions

Functions

deserialize

deserialize<T>(obj, typeGuard?): T

Turns the input object into an JSON object.

Remarks

It is equivalent to (except a bit more performant due to custom options)

let obj = { ... }
parse(stringify(obj), { extended: true })

Type parameters

Name Description
T Type of the output object

Parameters

Name Type Description
obj any The input object
typeGuard? TypeGuardFunction<T> The type guard function, ensures that the output object is of the expected type, refer to TypeGuardFunction for an example.

Returns

T

The JSON object

Defined in

serialize.ts:55


serialize

serialize<T>(obj, typeGuard?): T

Turns the input object into an EJSON object.

Remarks

It is equivalent to (except a bit more performant due to custom options)

let obj = { ... }
parse(stringify(obj, { extended: true }))

Type parameters

Name Description
T Type of the output object

Parameters

Name Type Description
obj any The input object
typeGuard? TypeGuardFunction<T> The type guard function, ensures that the output object is of the expected type, refer to TypeGuardFunction for an example.

Returns

T

The EJSON object

Defined in

serialize.ts:20