A header-only C++11 serialization library for converting data types to binary, XML, or JSON formats.
cereal is a header-only C++11 serialization library that converts arbitrary C++ data types into different representations like binary, XML, or JSON, and can reversibly restore them. It solves the problem of persisting and transferring complex C++ objects in a lightweight, dependency-free manner.
C++ developers working on applications that require data persistence, network communication, or configuration storage, particularly those using modern C++11 or later.
Developers choose cereal for its simplicity, header-only design with no external dependencies, support for multiple output formats, and ease of extending to custom types, making it a versatile and efficient serialization solution.
A C++11 library for serialization
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
As a header-only library with no external dependencies, cereal can be dropped into any C++ project instantly, simplifying integration and deployment as highlighted in the README's quick installation steps.
cereal supports binary, XML, and JSON serialization, providing flexibility for different use cases from compact storage to human-readable configs, directly mentioned in its key features.
Built-in serialization for common C++ standard library types like std::unordered_map and std::shared_ptr reduces boilerplate code, as shown in the provided code example.
Adding serialization for custom types is done via simple template functions, such as the serialize method in MyRecord, making it straightforward to adapt to user-defined data structures.
The extensive use of C++ templates can lead to significantly increased compilation times and larger executable sizes, especially in complex projects with many serialized types.
cereal lacks mechanisms for handling schema evolution, forcing developers to manually manage backward compatibility when data structures change, a common need in long-term projects.
Serialization errors often produce hard-to-decipher template instantiation messages during compilation, making debugging more challenging compared to libraries with runtime error handling.