RSS Feed for This PostCurrent Article

Open Source Binary Serialization Library

MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON but it’s faster and smaller. For example, small integers (like flags or error code) are encoded into a single byte, and typical short strings only require an extra byte in addition to the strings themselves.

If you ever wished to use JSON for convenience (storing an image with metadata) but could not for technical reasons (encoding, size, speed…), MessagePack is a perfect replacement.

In Java,

   1: import org.msgpack.MessagePack;


   3: MessagePack msgpack = new MessagePack();

   4: byte[] bytes = msgpack.write(object);

   5: MyClass object =, MyClass.class);

In C#,

   1: using MsgPack.Serialization;


   3: var serializer = MessagePackSerializer.Create<Foo>();

   4: serializer.Pack(foo, stream);

   5: stream.Position = 0;

   6: var value = serializer.Unpack(stream);

Trackback URL

RSS Feed for This PostPost a Comment

Refresh Image