DevToys Web Pro iconDevToys Web ProBlog
Rate us:
Try browser extension:

CBOR / MessagePack Codec

Format:
Direction:
Output:

JSON Input

  • Hex Output

  • Technical details

    How the CBOR & MessagePack Converter Works

    What the Tool Does

    This tool encodes JSON data into CBOR (Concise Binary Object Representation) or MessagePack binary formats, and decodes binary payloads back to human-readable JSON. It displays the raw hex bytes alongside the decoded structure, making it easy to inspect compact binary encodings used in constrained environments. Both encoding directions support nested objects, arrays, and standard JSON types.

    Common Developer Use Cases

    IoT developers use this tool to inspect CBOR payloads from CoAP messages or COSE-signed tokens without writing deserialization code. Backend engineers debug MessagePack-encoded WebSocket frames, Redis protocol buffers, or RPC payloads by pasting hex dumps and viewing the decoded JSON. It is also useful for comparing payload sizes between JSON, CBOR, and MessagePack to choose the most efficient wire format for bandwidth-constrained systems.

    Data Formats, Types, or Variants

    CBOR (RFC 8949) is a self-describing binary format designed for small code size and small message size, widely adopted in IoT standards like LwM2M and FIDO2/WebAuthn. MessagePack is a similar binary serialization that aims to be as compact as possible while remaining schema-free, commonly used by Redis, Fluentd, and many RPC frameworks. Both formats are more compact than JSON but sacrifice human readability for efficiency.

    Common Pitfalls and Edge Cases

    CBOR supports data types that JSON cannot represent natively, such as byte strings, tags, and indefinite-length containers — round-tripping these through JSON will lose type information. MessagePack distinguishes between raw bytes and UTF-8 strings, which JSON collapses into a single string type. Integer precision can differ: both formats support arbitrary-length integers, but decoding into JavaScript may lose precision beyond Number.MAX_SAFE_INTEGER.

    When to Use This Tool vs Code

    Use this browser tool for ad-hoc inspection of binary payloads captured from network traffic, debugging IoT device messages, or quickly comparing encoding sizes. For production serialization in application code, use dedicated libraries like cbor2 (Python), cbor-x (Node.js), or msgpack for your language, which handle streaming, schema validation, and proper type mapping that a browser tool cannot provide.