1. Home
  2. Developer tools
  3. CBOR to JSON

CBOR to JSON

CBOR is the binary format behind WebAuthn, COSE and many IoT protocols. Paste its bytes as hex or Base64 and read them as JSON, or encode a JSON document and inspect the bytes it produces.

Free, no sign-up. Runs in your browser: nothing is uploaded.

How to use CBOR to JSON

  1. Choose the direction.
  2. Paste hex or Base64, or open a file.
  3. Copy the result.

Features

  • Maps, arrays, text, byte strings, tags and simple values
  • Half, single and double precision floats
  • Integers beyond 2^53 kept exact as strings
  • Byte strings and tags shown as labelled objects
  • Indefinite-length items accepted
  • Reports truncated or invalid data with the byte offset

Supported formats

You can open

  • Hex
  • Base64
  • CBOR file
  • JSON

You get

  • JSON
  • Hex
  • Base64

Private by design

Your files are opened and processed by your browser on this device. They are never uploaded to openWorkstand or anyone else, so the CBOR to JSON is safe for contracts, IDs, photos and work documents. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Values JSON cannot hold, such as byte strings and tags, are shown as labelled objects.
  • Files over 2 MB are not opened.

Guide

Decoding CBOR (RFC 8949) into readable JSON

CBOR, the Concise Binary Object Representation, is the binary cousin of JSON that the IETF standardised in RFC 8949. It takes the JSON data model and adds byte strings, tags, a wider range of numbers and the option to stream items of unknown length. It appears in WebAuthn and passkeys, in COSE signed and encrypted messages, in CoAP for small devices, and in many IoT formats. Raw CBOR is unreadable, so this page decodes it and also writes JSON as CBOR.

How a CBOR item is built

Each data item starts with one byte whose top three bits are the major type and whose low five bits are additional information. Major type 0 is an unsigned integer, 1 a negative one, 2 a byte string, 3 a text string, 4 an array, 5 a map, 6 a tag and 7 floats and simple values. When the additional information is below 24 it holds the value or length directly; values 24 to 27 mean that the number follows in 1, 2, 4 or 8 bytes; 31 starts an indefinite-length item that ends with a break byte, 0xff.

Using the page

Pick a direction. To decode, paste hex or Base64, or open a file, and read the JSON with its byte count. To encode, paste JSON, choose the output form and copy the bytes. A message that is cut short, uses a reserved value or has bytes left over after the first item produces an error with the offset. Nothing is uploaded; the bytes are decoded in your browser.

Values JSON cannot hold

JSON has no byte strings, tags or large integers, so the page shows them in a way that loses nothing. A byte string is an object with a $binary key holding its hex. A tagged value is an object with $tag (the tag number) and value, so a date tagged 1 appears with its number rather than as a formatted time. Integers beyond 2 to the 53rd power are strings. Half-precision floats are expanded to ordinary numbers. Map keys that are not text are shown as text.

Floats and the shortest form

The CBOR rules recommend that an encoder write each number in the shortest form that preserves it. The integer 500 needs two bytes after the head (19 01 f4), and 1.5 fits a half-precision float (f9 3e 00), whereas 0.1 needs a full double (fb followed by eight bytes). When the page encodes JSON, it follows these rules, which is why two encoders can produce different bytes for the same data and still be correct.

A worked example

The Sample button loads the example from the RFC: a2 61 61 01 61 62 82 02 03, nine bytes. a2 is a map (major type 5) with two pairs. 61 61 is a text string of length 1, “a”, and 01 is the integer 1. 61 62 is the string “b”, and 82 starts an array of two items, 02 and 03. The JSON is {“a”: 1, “b”: [2, 3]}. Encoding {“id”: 7, “ok”: true, “tags”: [“a”, “b”]} gives a362696407626f6bf564746167738261616162, 19 bytes.

Limits

Tags are shown as numbers and not interpreted, so a timestamp tag is not converted to a date and a bignum tag is not turned into a number. Indefinite-length items are read but encoded as definite ones. The page processes one top-level item; sequences of items (CBOR sequences) must be split first. Decoding does not verify signatures or encryption in COSE and WebAuthn structures, it only shows their contents.

Checked against the current version of the CBOR to JSON on .

Troubleshooting

The file does not open

Check that it is one of the supported formats above and opens in another app. Damaged files and password-protected PDFs cannot be read until they are repaired or unlocked.

It is slow or stops on a very large file

Everything runs on your device, so speed depends on its memory. Close other tabs, use a computer rather than a phone, or split the file into smaller parts first.

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

What is the difference between CBOR and MessagePack?

They are close relatives with different details. CBOR is a standard of the IETF with a formal specification, tags for extensibility, indefinite-length items and half-precision floats; MessagePack has a simpler type table. CBOR is the choice of security-related standards such as WebAuthn and COSE, while MessagePack is common in application protocols.

Why does a decoded float look different from the value I encoded?

Because CBOR can store a float in 16, 32 or 64 bits, and an encoder chooses the shortest that holds the value exactly. The decoded number is the same, but the byte length differs, and a number such as 0.1 needs the full 64 bits.

What is the sample bytes a2 61 61 01 61 62 82 02 03?

It is an example from RFC 8949: a map with two entries, "a" mapped to 1 and "b" mapped to the array [2, 3].

What about values JSON cannot hold?

Byte strings and tags appear as objects with a marker key, so nothing is silently lost.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.