Skip to content

Supported formats

reflect-cpp provides a unified reflection-based interface across different serialization formats. They are listed below:

Comparing formats

When choosing a format for your use case, consider the following factors:

  1. Readability: JSON, YAML, TOML, and CSV are human-readable. Binary formats (BSON, CBOR, UBJSON, msgpack, Avro, Cap’n Proto, yas, etc.) are not.
  2. Performance: For raw speed, yas, msgpack, and flexbuffers are typically the fastest. Note that due to a highly efficient implementation, JSON is a lot faster than you might think.
  3. Backwards compatibility: Schemaless formats (JSON, YAML, TOML, BSON, CBOR, UBJSON, msgpack, Flexbuffers) tolerate structural changes better than schemaful formats.
  4. Data structure: Nested, hierarchical data works best with JSON, YAML, or XML. Flat, tabular data works best with CSV or Parquet.
  5. External dependencies: Some formats require linking to external libraries (Avro, Cap’n Proto, CBOR, msgpack, YAML, TOML, XML, BSON, Boost.Serialization, Cereal, Flexbuffers). JSON and environment variables have no external dependencies.

Textual formats

Human-readable formats for configuration, data exchange, and legacy integration.

JSON-like binary formats

Compact binary formats designed for small payload sizes and interoperability.

Schemaful binary formats

Binary formats that require a predefined schema, enabling strict type safety and efficient serialization.

Tabular formats

Formats designed for storing collections of records, optimized for analytical workloads and data exchange.

C++ serialization libraries

C++-native serialization libraries offering compact, high-performance binary output.

Other

Non-serialization interfaces for configuration and command-line integration.