Format Atlas

Data

What is CBOR?

CBOR (Concise Binary Object Representation) is an IETF standard for encoding data items such as numbers, strings, arrays, and maps in binary. It is designed to support compact implementations and messages while remaining extensible, and it can represent JSON-like data. It is not a text format, so reading and writing it requires a CBOR-aware tool or library.

.cborCompact binary encoding for data items

When to choose this format

  • Representing JSON-like data in a compact binary form
  • Using standard or application-defined tags to convey meaning

When to avoid this format

  • Data that people need to read and edit directly as text
  • Mixing CBOR profiles or encoding rules without agreement between endpoints

Common uses

  • Structured data exchange on constrained devices and networks
  • Data representation in COSE and IoT protocols

Features

  • RFC 8949 defines application/cbor and the .cbor extension
  • Represents integers, floating-point values, byte strings, arrays, and maps
  • Tags can add meaning such as dates or application-specific values

Advantages and disadvantages

Advantages

  • Compact encoding suits constrained environments
  • A general decoder can read basic structure without a fixed schema shared in advance

Disadvantages

  • Binary contents are difficult to inspect in a text editor
  • Equivalent data can have multiple encodings, so signatures and hashes may require deterministic encoding rules
  • A CBOR Sequence is a concatenation format distinct from one CBOR item and uses a different media type

Open and convert

How to open

Read it with a CBOR library or decoder, then inspect its diagnostic notation or a JSON-like view. Check how values without direct JSON equivalents, such as tags and byte strings, are represented.

How to convert

When converting to JSON, byte strings and tagged values may need tool-specific representations because JSON has no direct equivalents. For signatures, hashes, or cache keys, follow the protocol's agreed encoding rules, such as deterministic encoding in RFC 8949.

Cautions

  • A CBOR data item and a CBOR Sequence are different. If multiple items are concatenated, confirm that the receiver expects a sequence as defined by RFC 8742.
  • Follow the protocol definition for tag meanings and application profiles.
  • application/cbor is for one CBOR data item. Check the receiving specification for framing and content expectations.

FAQ

Is CBOR a compression format?

No. CBOR encodes data structures in binary; it is not a general-purpose compression algorithm.

Can CBOR represent the same data as JSON?

It can represent JSON-like values, but CBOR also has features such as byte strings and tags that JSON lacks. Conversion needs a policy for those values.

Related formats

Compare

References and specifications