encode

function of dascore.workflow.serialize source

encode(
    obj: Any ,
    mode: Literal[‘fingerprint’, ‘document’] = fingerprint,
)-> ‘Any’

Return a JSON-safe tree standing for an object.

Parameters

Parameter Description
obj The object to encode.
mode Either “fingerprint” (the default) or “document”; see the module
docstring.

Examples

import numpy as np
from dascore.workflow.serialize import encode
encode(np.arange(3), mode="document")["$array"]["data"]
[0, 1, 2]