Format Atlas

Compare

Avro vs CBOR

Apache Avro encodes records according to a schema and supports writer/reader schema resolution and container files. CBOR is a general binary format with an extended JSON data model, including direct byte strings and tags.

Which format should you choose?

Consider Avro for managed schemas, typed records, and schema evolution in data pipelines. Consider CBOR for generic binary values, tags, and protocol payloads defined by an IETF standard.

Good fit for Avro

Exchange records with a defined schema

  • Events and data pipelines that track schema versions

Good fit for CBOR

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

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

Basic information

FieldAvroCBOR
Extension.avro.cbor
MIME typeapplication/avroapplication/cbor
Common usesExchange records with a defined schemaStructured data exchange on constrained devices and networks · Data representation in COSE and IoT protocols
How to openUse an Avro-aware tool to inspect the schema, fields, types, and records.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.
Export or convertWhen converting to JSON or Parquet, verify field names, types, nulls, logical types, record counts, and schema compatibility.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.

Choose by use case

Events and data pipelines that track schema versions

Exchange records with a defined schema

Avro

Representing JSON-like data in a compact binary form

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

CBOR

Using standard or application-defined tags to convey meaning

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

CBOR

Key point 1

Avro decoding requires the writer schema; its object container file can carry the schema. CBOR encodes typed data items such as maps and tags, but application-specific schema evolution is separate.

More on the differences

Key point 2

Avro defines records, unions, enums, and logical types through schemas. CBOR defines integers, byte strings, arrays, maps, and tags without prescribing one record-schema system.

More on the differences

More on the differences

Use Avro when producers and consumers manage compatible schemas and record evolution. Use CBOR when a protocol needs a general compact binary data model, including byte strings or tags. Verify schema distribution, deterministic encoding requirements, and implementation support.

  • Avro data is interpreted using its writer schema, and container files can include that schema. CBOR items carry binary type information; application-level schema contracts are not supplied automatically.
  • Avro schema resolution can reconcile writer and reader schemas. CBOR tags can add semantics to common data items, but both sides must agree on tag meaning and handling.
  • The byte encodings are not interchangeable. When converting, check unions, logical types, defaults, missing values, CBOR tags, integer ranges, byte strings, deterministic encoding, and unknown extensions.

Frequently asked questions

Can CBOR decode Avro data without a schema?

No. The formats have different encodings; Avro decoding needs its writer schema. A conversion must explicitly map the schema and values into CBOR data items.

Learn more

References and specifications