Skip to content

octoprint.util.json.encoding#

JsonEncoding #

add_encoder(typ: type, encoder: Callable[[Any], Any]) -> None classmethod #

Add an encoder for a type.

:param typ: the type to add an encoder for :param encoder: the encoder. Must take a single argument and return a tuple (name, parameters...)

dumps(obj: Any) -> str classmethod #

Dump an object to JSON, handles additional types that the JSON encoder can't, like bytes and frozendicts.