Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Microsoft Open Sources Cross-platform Serialization Library – Bond

Microsoft Open Sources Cross-platform Serialization Library – Bond

Last month Microsoft open sourced Bond, a cross-platform framework for processing schematized data. Bond supports cross-language serialization/deserialization and powerful generic mechanisms for efficiently manipulating data. The framework is broadly used at Microsoft in high-scale services. The project is currently available at GitHub under the permissive MIT license. Current version supports C++, C# and Python and is available on Linux, OS-X and Windows. The Bond compiler is written in pure Haskell.

Bond shares many similarities with other serialization systems, for example Google Protocol Buffers,  Thrift and Avro:

  • Bond messages are defined in the IDL – like language
  • It maps all Bond’s data type to the native language data types

Bond’s implementation however has one major difference: it doesn’t hard-code type mappings. It allows one to plug-in many things that aren't part of the core schema logic -whether to serialize from Bond schemas or a custom type, what the wire format is, whether to put custom metadata in the payload, and so on. For example, in C++ the defaults are STL containers like std::vector; however, a user can easily map custom types - using Python’s boost::multi index container in a generated C++ struct or mapping a uint64 schema field to a System.DateTime field in a generated C# class-. Bond generated C++ structs can also use custom allocators.

A nice comparison between Bond and Google Protocol Buffers is presented is this Stack Overflow post:


  • Bond supports generics
  • Bond has different types to represent collections: vector<T>, map<T>, list<T>
  • Bond supports type-safe lazy deserialization (bonded<T>)
  • Bond supports multiple formats (fast binary, compact binary, XML, JSON) + marshaling and transcoding


  • Bond doesn't support different types for fixed and variable integer encoding. In Bond, the way how integers are encoded is determined by the output format (fast or compact), but in Protocol Buffers, there are integer types that always have fixed size: fixed32 and fixed64.
  • Bond doesn't support union types (oneof in Protocol Buffers)
  • Bond doesn't have Java implementation (yet)

In addition, this announcement on Reddit has many answers about Bond’s implementation and capabilities.

Considering the current trend of growing SOA usage in the form of microservices, the issue of data marshalling/unmarshalling is becoming quite important. Bond can become a useful alternative to existing serialization systems.

Rate this Article