Skip to content


SerializableJsonEncoding #

Bases: JsonEncoding

A JSON encoding that can serialize and deserialize objects, including additional

objects otherwise not serializable by the standard JSON encoder
  • bytes
  • frozendict.frozendict
  • datetime.datetime
  • time.struct_time

decode(dct) classmethod #

Recursively replace all instances of decodable types with their decoded values.

You'll want to have used class_encode() in your encoder to get this to work properly.

encode(val) classmethod #

Recursively replace all instances of encodable types with their encoded value. This is useful over the default= functionality of the JSON encoder because JSON will not call default for tuples, lists, ints, etc:

Cannot handle circular references.

class_encode(name: str, *params: Any) -> Dict[str, List] #

Encode a class name and parameters into a serializable dict. You'll probably want to use this if you're going to set a custom decoder.

This stores the class names in a format inspired by the JSON-RPC spec at