MessagePack Codec¶
Codec for serialising and de-serialising data in MessagePack format. Supports both array and objects for mapping into resources or collections of resources.
The MessagePack codec uses the msgpack-python
module.
Methods¶
Customising Encoding¶
Serialisation of Odin resources is handled by a customised msgpack.Packer
. Additional data types can be
appended to the odin.codecs.msgpack_codec.TYPE_SERIALIZERS
dictionary.
Example usage¶
Loading a resource from a file:
from odin.codecs import msgpack_codec
with open('my_resource.msgp') as f:
resource = msgpack_codec.load(f)