Skip to content

What is CBOR? And why choose CBOR?

Faye Amacker edited this page Jun 28, 2021 · 1 revision

What is CBOR?

CBOR is a concise binary data format inspired by JSON and MessagePack. CBOR is defined in RFC 8949 (December 2020) which obsoletes RFC 7049 (October 2013).

CBOR is an Internet Standard by IETF. It's used in other standards like WebAuthn by W3C, COSE (RFC 8152), CWT (RFC 8392), CDDL (RFC 8610) and more.

Why CBOR?

It depends on your requirements and priorities. Reasons for using CBOR include:

  • CBOR is an IETF Internet Standard designed to be relevant for decades without breaking changes.

  • CBOR is designed to offer extensibility without the need for version negotiation.

  • Data is self-describing and avoids problems caused by generated code (or schemas) being out of sync with data.

  • Data is smaller and more efficient to process than JSON. And CBOR's generic data model is a superset of JSON's.

  • Using CBOR can reduce time spent maintaining large systems, especially when used with Go struct tags like toarray and keyasint provided by fxamacker/cbor.

Given these reasons, some projects replaced JSON with CBOR. Or migrated from gRPC+protobuf to gRPC+CBOR.

Clone this wiki locally