MessagePack Encoder & Decoder
Read MessagePack bytes as a value tree with byte offsets, extension types and timestamps, or turn JSON into the shortest MessagePack encoding — useful for payloads from Redis, Fluentd, RPC and log pipelines.
MessagePack is a compact binary serialization format that mirrors JSON’s types. Small integers, short strings, short arrays and short maps each fit in a single header byte, so a typical payload is smaller than the same value written as JSON. Decoding reads one top-level value, rejects trailing bytes, validates UTF-8 in strings, and reports every item’s byte offset, encoded length, format name and value. Extension values are shown with their type number; the built-in timestamp type (-1) is also rendered as an ISO 8601 instant from its 4-, 8- or 12-byte payload. Integers wider than JavaScript’s safe range appear as exact decimal strings so no digits are rounded, and encodings that use more bytes than the shortest form are flagged rather than hidden. Encoding takes a JSON value and writes the shortest MessagePack form, with markers for data that JSON cannot express: {"$bin":"0102ff"}, {"$ext":{"type":2,"data":"0102"}}, {"$float":"NaN"}, {"$bigint":"18446744073709551615"}, {"$map":[[1,"a"]]} and {"$timestamp":{"seconds":1700000000,"nanoseconds":0}}. Inputs are limited to 4,096 bytes, 2,000 values and 32 levels of nesting. Everything runs in your browser; nothing is sent or stored.