Skip to content

pymmcore_plus.metadata.serialize

Functions

Name Description
encode_hook Hook to encode objects that are not JSON serializable.
msgspec_json_dumps Serialize object to bytes.
msgspec_json_loads Deserialize bytes to object.
msgspec_to_builtins Convert object to built-in types.
msgspec_to_schema Generate JSON schema for a given type.
schema_hook Hook to convert objects to schema.
std_json_dumps Serialize object to bytes.
std_json_loads Deserialize bytes to object.
std_to_builtins Convert object to built-in types.

Attributes

Name Description
json_loads Deserialize JSON bytes (or a string) to Python objects.

Functions

encode_hook

encode_hook(obj: Any, raises: bool = True) -> Any

Hook to encode objects that are not JSON serializable.

schema_hook

schema_hook(obj: type) -> dict[str, Any]

Hook to convert objects to schema.

msgspec_json_dumps

msgspec_json_dumps(obj: Any, *, indent: int | None = None) -> bytes

Serialize object to bytes.

msgspec_json_loads

msgspec_json_loads(s: bytes | str) -> Any

Deserialize bytes to object.

msgspec_to_builtins

msgspec_to_builtins(obj: Any) -> Any

Convert object to built-in types.

msgspec_to_schema

msgspec_to_schema(type: Any) -> Any

Generate JSON schema for a given type.

std_json_dumps

std_json_dumps(obj: Any, *, indent: int | None = None) -> bytes

std_json_loads

std_json_loads(s: bytes | str) -> Any

std_to_builtins

std_to_builtins(obj: Any) -> Any

Attributes

json_loads

json_loads = std_json_loads

Deserialize JSON bytes (or a string) to Python objects.

Re-exports

These can also be imported from this module, but each is documented under its shortest import path (linked below).

Name Description
json_dumps Serialize obj (e.g. a metadata dict) to JSON bytes.
to_builtins Convert obj (e.g. a metadata dict) to builtin Python types.