1001Ferramentas
๐Ÿ”„Converters

MessagePack to JSON (text) Converter

Explains the MessagePack binary format, its advantages and how to translate it into textual JSON.

Paste the MessagePack bytes as hex. Bin becomes 0xโ€ฆ; ext becomes {$ext, data}. 64-bit integers can lose precision above 2โตยณ.

MessagePack is a compact binary format that is faster than JSON on the wire. The types it supports include int, float, string, bin, array, map and ext.

To convert it in your own code, use libraries such as @msgpack/msgpack (JS) or msgpack (Python). In those libraries, byte strings are serialized as base64 once they become JSON.

Decoding a MessagePack payload by hand

MessagePack usually comes out of a Redis instance, a WebSocket feed or a cache someone configured years ago, and in those moments you have a binary blob and no documentation. If you can get that blob into hex, this page does the rest: paste the bytes and read the matching JSON. The sample 82a16101a162920203 opens a map with two fields, a set to 1 and b set to the list 2, 3.

The decoder covers the whole prefix family: positive and negative fixint, fixstr, fixmap, fixarray, str in 8, 16 and 32-bit forms, bin, large arrays and maps, floats, signed and unsigned integers, plus the extension types. Bin blobs become text starting with 0x, and an ext becomes an object carrying $ext and data. That includes the standard timestamp, which is ext type -1 and stays as bytes rather than becoming a date.

Watch out for large integers: a uint64 at its maximum prints as 18446744073709552000, rounded, because the value passes through a JavaScript number. The explainer on the page mentions base64 for byte strings, but the actual output is hex. The trip is one way too, there is no JSON back to MessagePack here. For volume or a faithful round trip, reach for @msgpack/msgpack. Nothing leaves your browser.

Frequently asked questions

Can I go from JSON back to MessagePack?
Not here. This page only decodes hex bytes into JSON.
Why did the timestamp become an object with $ext?
MessagePack timestamps are extension type -1, and extensions are returned raw, as the type number plus the bytes in hex, with no interpretation.
Can I trust 64-bit integers?
Up to 2 to the 53rd, yes. Above that the value is rounded, because the output passes through a JavaScript number.

Related Tools