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:
- Readability: JSON, YAML, TOML, and CSV are human-readable. Binary formats (BSON, CBOR, UBJSON, msgpack, Avro, Cap’n Proto, yas, etc.) are not.
- 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.
- Backwards compatibility: Schemaless formats (JSON, YAML, TOML, BSON, CBOR, UBJSON, msgpack, Flexbuffers) tolerate structural changes better than schemaful formats.
- Data structure: Nested, hierarchical data works best with JSON, YAML, or XML. Flat, tabular data works best with CSV or Parquet.
- 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.
Out-of-the-box support via yyjson. Standard for web APIs and data interchange.
Textual format with an emphasis on readability. Widely used in Docker, Kubernetes, and CI/CD configuration.
Textual format with an emphasis on readability. Popular for application configuration in the Rust ecosystem.
Tabular textual format. The universal interchange format for spreadsheets, databases, and ETL pipelines.
Textual format used in many legacy projects. Dominates enterprise SOAP APIs and document formats.
JSON-like binary formats
Compact binary formats designed for small payload sizes and interoperability.
JSON-like binary format. Native storage format for MongoDB.
JSON-like binary format. IETF-standardized (RFC 7049); widely used in IoT and JWT tokens.
JSON-like binary format. Optimized for speed; popular in RPC frameworks like gRPC. Very fast.
JSON-like binary format. A more efficient binary replacement for JSON in network protocols.
Schemaful binary formats
Binary formats that require a predefined schema, enabling strict type safety and efficient serialization.
Schemaful binary format. Widely used in big data pipelines (Apache Hadoop, Kafka) for schema evolution.
Schemaful binary format. Designed for game networking and IPC.
Tabular formats
Formats designed for storing collections of records, optimized for analytical workloads and data exchange.
Tabular textual format. The universal format for spreadsheets, databases, and ETL pipelines.
Tabular binary format. Columnar storage of choice for data warehousing and Apache Spark.
C++ serialization libraries
C++-native serialization libraries offering compact, high-performance binary output.
C++ serialization library with multiple formats. Commonly used in game development and scientific computing for checkpoint/restart workflows.
Schema-less version of flatbuffers, binary format. Ideal for game assets and dynamic data without code generation. Very fast.
Very fast and compact serialization library. Targets applications where speed and memory matter. Very fast.
Streaming binary format with archive interop. Integrates with the broader Boost ecosystem for object graph serialization.
Other
Non-serialization interfaces for configuration and command-line integration.