Serialization API Reference¶
Message serialization and deserialization with JSON and msgpack support.
Base64Serializer
¶
A wrapper serializer that encodes binary data into Base64 strings. Useful for passing binary payloads through JSON-only or HTTP/text transport.
Source code in src/istos/messages/serialization.py
JsonSerializer
¶
Serializes and deserializes messages using JSON.
default=str lets common non-JSON-native types (datetime, Decimal, UUID,
Path, etc.) serialize to their string form instead of raising TypeError.
Source code in src/istos/messages/serialization.py
MsgPackSerializer
¶
Serializes and deserializes messages using MessagePack.
raw=False pins string decoding so peers on different msgpack versions
agree (str stays str, binary stays bytes) rather than depending on the
library default.
Source code in src/istos/messages/serialization.py
ProtobufSerializer
¶
Serializes and deserializes messages using Protocol Buffers.
Source code in src/istos/messages/serialization.py
PydanticSerializer
¶
Bases: Generic[T]
Serializes and deserializes Pydantic models. Provides automatic validation on deserialization.
Source code in src/istos/messages/serialization.py
RawSerializer
¶
Passthrough serializer for already-encoded payloads.
Zenoh payloads are raw bytes; this serializer moves bytes (or str,
encoded as UTF-8) across the network without wrapping them in JSON/msgpack.
Use it for opaque or pre-encoded data: binary sensor frames, images, tokens,
or the output of another serializer. Deserialization always yields bytes.
Source code in src/istos/messages/serialization.py
Serialize
¶
Bases: Protocol
Interface for serializing and deserializing messages.
Source code in src/istos/messages/serialization.py
deserialize(data)
¶
YamlSerializer
¶
Serializes and deserializes using YAML. Useful for configurations or cross-language readable messages.