Loading CBOR to JSON Converter...
Please wait a moment

How to Convert CBOR to JSON - Step by Step Guide

Step 1

Input Your CBOR Data

Let's decode your CBOR (Concise Binary Object Representation) data! Whether you're working with IoT devices, embedded systems, or compact data formats from RFC 8949 compliant sources, you have several convenient options to get started:

•
Paste directly: Copy your CBOR data in Base64 or Hex format from your database, IoT application, or MQTT broker and paste it directly into the input editor
•
Upload a file: Click "Upload" to select a .cbor, .bin, or .txt file containing CBOR data from your computer or mobile device
•
Try the sample: Click "Sample" to load example CBOR data (featuring "Maeve") and see the instant JSON conversion in action
•
Toggle input format: Switch between Base64 (default) and Hex format depending on how your CBOR data is encoded

Example: CBOR Input (Base64)

Here's what encoded CBOR data looks like:

o2RuYW1lZU1hZXZlY2FnZRgeZmFjdGl2ZfU=
Step 2

Automatic Decoding & Analysis

There is no Convert button. About half a second after you stop typing, the bytes are decoded in your browser and the JSON shows up on the right. Here is what happens along the way:

•
Every integer keeps its digits: uint64 and int64 values, and bignums (tags 2 and 3), are written as plain JSON numbers with every digit, so an ICCID like 8901240544102066246 doesn't turn into …066000.
•
Floats stay floats: a CBOR float 2.0 is written as 2.0, not 2, so it reads back as the same type.
•
Things JSON lacks are spelled out: byte strings become Base64 text, epoch dates (tag 1) become ISO 8601 text, undefined becomes null and NaN/Infinity become text. A blue note above the output lists each change.
•
Problems are named: cut-off data, a bad Base64 or hex character (with its line and column), invalid UTF-8 in a text string, or hex pasted while the Base64 mode is on are each reported in plain words.
•
Several values in a row: a CBOR sequence (values written back to back) is shown as a JSON array.

Example: Decoded JSON Output

The same CBOR, now decoded as readable JSON:

{
  "name": "Maeve",
  "age": 30,
  "active": true
}
Step 3

Choose Format Options

Pick the mode that matches how your bytes were written down. If you paste into the wrong one, the page tells you instead of showing garbage.

•
Base64 (default): what you usually get when CBOR travels inside JSON, a database text column or an HTTP API. Standard and URL-safe Base64 both work, with or without = padding, and a data:…;base64, prefix is fine.
•
Hex: what debuggers, Wireshark and cbor.me show. Spaces, colons, commas and 0x prefixes between bytes are ignored.
•
Switching modes: toggling re-spells the input in the other format (same bytes). If the text isn't valid in the current mode, it is left exactly as you typed it.
Step 4

Export Your JSON Data

Once the JSON looks right, take it with you:

•
Copy: puts the JSON on your clipboard exactly as shown.
•
Download: saves it as converted.json.
•
Keep going: pretty much any JSON tool works on the result, for example the JSON Formatter, the JSON Validator or JSON to Table if the data is a list of records. To go the other way, use JSON to CBOR.

Frequently Asked Questions

What is CBOR and why convert it to JSON?

CBOR (Concise Binary Object Representation, RFC 8949) is a binary format with the same building blocks as JSON: maps, arrays, text, numbers, true/false and null, plus a few extras such as byte strings and tags. It shows up wherever bytes are expensive: IoT sensors, CoAP and MQTT payloads, WebAuthn/FIDO2 attestation data, COSE signatures and EU Digital COVID Certificates. Because it is binary you can't read it in a text editor, so turning it into JSON is the quickest way to see what a payload actually contains.

Where do I get the CBOR to paste here?

Usually from a log line, an API response or a database column, where the bytes have already been written as Base64 or hex. You can also make some yourself: Python's cbor2, JavaScript's cbor-x, Go's fxamacker/cbor, Rust's ciborium or Java's Jackson CBOR module all write CBOR. If you have a raw .cbor or .bin file, upload it and the page reads the bytes directly.

What happens to CBOR types that JSON doesn't have?

Integers of any size, including uint64, int64 and bignums (tags 2 and 3), are written as JSON numbers with every digit. Floats stay floats (2.0 rather than 2). Byte strings become Base64 text. Date strings (tag 0) are kept as written and epoch dates (tag 1) become ISO 8601 text in UTC. undefined becomes null, NaN and Infinity become the text "NaN" and "Infinity", and map keys that aren't text (such as 1 or 2) are written as text, because JSON keys must be strings. Any other tag is shown as {"tag": number, "value": …}. Whenever one of these changes happens, a note above the output says so.

Why does my long ID look right here but change in my own code?

The page writes 8901240544102066246 exactly as it was stored. But JavaScript's JSON.parse turns any integer above 9007199254740991 into the nearest double, so a browser or Node script reading the JSON may still round it. Python's json module and Jackson with BigInteger keep it exact. If the JSON is going into JavaScript, treat such IDs as strings.

Should I paste Base64 or Hex?

Whichever your data is already in. Base64 is shorter and is what you normally find inside JSON, databases and APIs; hex is what debuggers, Wireshark and cbor.me show. URL-safe Base64, missing padding, a data: prefix and hex with spaces, colons or 0x prefixes are all accepted. If you paste hex while Base64 is selected (or the other way round), the page tells you to switch rather than showing nonsense.

My input holds several CBOR values. What happens?

Values written back to back, which RFC 8742 calls a CBOR sequence, are shown as one JSON array with one entry per value. If the data ends in the middle of a value, you get an error saying it looks cut off instead of a partial result.

How big a file can I decode?

Everything runs in your browser, so the limit is your device. A file with a few thousand records decodes in well under a second; files of tens of megabytes work but get slow, mostly because the JSON is shown in a text editor. For hundreds of megabytes, a short script with cbor2 or cbor-x will be faster.

Is my data uploaded anywhere?

No. The CBOR is decoded by JavaScript on this page and nothing you paste or upload is sent to a server. The tool is free and needs no account.