BOSS serialization protocol

BOSS (Binary Object Serialization Specification) protocol is a binary-effective serialization

BOSS is the bit-effective, platform-independent streamable and traversable typed binary protocol. Allows to effectively store small or any sized integers, strings or binary data of any size, floats and doubles, arrays and hashes and time objects in a very effective way. It allows automatic data caching and a stream mode without it. There are

The protocol allows to effectively store:

  • text strings and binary data of absolutely any size,
  • signed integers of absolutely any size (including small ones – using variable-length integers),
  • frequently used constans, like 0, 1, -1, 0.0, 1.0, -1.0, null, etc are packed to one byte
  • arrays and hashes with no limit on items and overall gross size.

It caches repeated objects and stores/restores links to objects. It is desirable to use build-in compression when appropriate.

“Streamable” means that you can use a pipe (for example TCP/IP), put the object at one side and load it on other, one-by-one, and caching and links will be restored properly.

Initially, this protocol was intended to be used in secure communications. Its main goal was to send data effectively, acting as a great replacement for JSON or other serialization protocols. For example, using BOSS, a typical JSON document is reduced in size about twice.

BOSS protocol also allows to transparently compress its representations.

BOSS also supports “stream mode” that lacks tree reconstruction but could be effectively use when implementing long-living streams (e.g. stream protocols). In regular mode it causes unlimited cache grows as BOSS would try to reconstruct all possible references to already serialized objects. In the stream mode only strings are cached, and cache size and capacity are dynamically limited. BOSS writes the stream mode marker and handles stream mode on receiving end automatically.

Supported types:

  • Signed integers of any length;
  • Signed floats and doubles (4 or 8 bytes);
  • Boolean values (true/false);
  • UTF-8 encoded texts, any length;
  • Binary data, any length;
  • Date objects (date and time with 1 second resolution);
  • Arrays with any number of mixed type elements;
  • Hashes with any keys and values and unlimited length;
  • Reference to the object that already was serialized (unless in stream mode).


Kotlinx serialization

See, allows to use BOSS with a great kotlinx.serialization framework.

Java Boss library

repositories { 
    maven( "") 
dependencies {

See BOSS object.


There is a NPM module Unicrypto that works well in both browser and nodejs environment. It is widely used and production stable.


There is stable and production-ready ruby gem for it:  sergeych/boss_protocol. This gem is in use in many production environments.


There is a BOSS codec in the Universa U8 engine but it may not be easy to extract it from there.