JSON to MessagePack

Input
Output

JSON to MessagePack

MessagePack is a binary JSON: the same data in fewer bytes, used by Redis, Fluentd, SignalR and many RPC and game protocols. Paste JSON to get its MessagePack bytes and see the size next to the JSON's.

Example: a sensor reading

A small telemetry message, the kind a device sends many times a minute. As MessagePack it takes 51 bytes instead of the minified JSON's 72, and the 64-bit timestamp in nanoseconds keeps every digit:

Input

{
  "device": "pump-7",
  "tempC": 41.5,
  "ok": true,
  "tsNanos": 1793268000123456789
}

Output

84a6646576696365a670756d702d37a574656d7043cb4044c00000000000a26f6bc3a774734e616e6f73cf18e2f7beb66f0d15

How do I use the JSON to MessagePack?

  1. Paste JSON.
  2. Pick Base64 or hex output.
  3. Copy the bytes, or press Save for a .msgpack file.

What does the JSON to MessagePack do?

  • Size compared with the JSON
  • Base64 or hex output, or a .msgpack file
  • 64-bit integers written exactly

When to use the JSON to MessagePack

MessagePack stores the same data as JSON in fewer bytes and parses faster, which is why Redis, Fluentd, SignalR, many RPC frameworks, games and IoT devices use it. Encoding a JSON sample shows exactly what a client should send, gives test data for a decoder, and tells you how much smaller your payloads would be.

Numbers take only the bytes they need, short strings carry a one-byte length, and true, false and null are one byte each, so small messages shrink most. Integers beyond JavaScript's safe range, such as nanosecond timestamps, are written as exact 64-bit values. Output is Base64 or hex; Save gives a .msgpack file, and MessagePack to JSON reads it back.

Frequently asked questions

How much smaller is MessagePack than JSON?
It depends on the data: the note under the output gives the exact sizes. Messages with many numbers and short keys shrink most; long text barely changes, since strings are stored as they are. Compressing JSON with gzip can come close for big payloads.
Will a big integer lose digits?
No. A number such as 1793268000123456789 is written as an exact 64-bit integer, although JavaScript's JSON.parse would round it. Bracely keeps the digits from your text.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 104 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.1 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram