Skip to content

CBOR Encode & Decode

Convert between JSON and CBOR, the binary format behind WebAuthn attestations, COSE signatures and most IoT payloads.

Input

Output

JSON’s binary counterpart

CBOR has the same data model as JSON — numbers, strings, arrays, maps, booleans, null — encoded as bytes instead of text. It is smaller, unambiguous about integer types, and can carry raw binary without Base64.

You most often meet it inside a WebAuthn attestation object, a COSE signature, or an IoT payload, where it arrives as a wall of hex that has to be read before anything else makes sense.

Decoding here renders byte strings as h'…' so they stay distinguishable from text, and preserves tag numbers rather than silently unwrapping them.

Frequently asked questions

Why does my decoded output show h'0102' instead of a string?

That is a CBOR byte string, which is a distinct type from a text string. Showing it as hex keeps the distinction visible — JSON has no way to express it.

What is __cborTag in the output?

A CBOR tag annotating the value that follows it — tag 1 is an epoch timestamp, tag 2 a bignum. The number is preserved so you can see what the encoder meant.

Related tools