| Name | Modified | Size | Downloads / Week |
|---|---|---|---|
| Parent folder | |||
| README.md | 2025-12-19 | 5.3 kB | |
| v6.4.0 source code.tar.gz | 2025-12-19 | 1.1 MB | |
| v6.4.0 source code.zip | 2025-12-19 | 1.3 MB | |
| Totals: 3 Items | 2.4 MB | 3 | |
CBOR, MessagePack, generic_i64, generic_u64
This release adds support for CBOR and MessagePack along with enhanced runtime JSON manipulation capabilities and new generic JSON integer types.
New Formats
CBOR (Concise Binary Object Representation)
Glaze now provides comprehensive support for CBOR (RFC 8949). CBOR is an IETF standard that enables excellent interoperability with other languages and systems. [#2145]
:::c++
#include "glaze/cbor.hpp"
my_struct s{};
std::string buffer{};
glz::write_cbor(s, buffer);
my_struct result{};
glz::read_cbor(result, buffer);
Key Features:
- RFC 8949 compliance - Core CBOR specification support
- RFC 8746 typed arrays - Bulk memory operations for contiguous numeric containers (vectors, arrays)
- Multi-dimensional arrays - Row-major (tag 40) and column-major (tag 1040) support
- Eigen matrix support - Native serialization of fixed and dynamic Eigen matrices
- Complex numbers - IANA-registered tags (43000, 43001) for single and array complex types
- Floating-point preferred serialization - Automatically uses the smallest representation (half/single/double)
- Exceptions API - glz::ex::write_cbor / glz::ex::read_cbor for exception-based error handling
- Fuzz tested - Comprehensive fuzzing for robustness [#2149]
MessagePack
MessagePack support. [#2015]
:::c++
#include "glaze/msgpack.hpp"
my_struct s{};
std::string buffer{};
glz::write_msgpack(s, buffer);
my_struct result{};
glz::read_msgpack(result, buffer);
Key Features:
- Spec 2.0 compliance - Core types, extension types, and timestamp extension
- Timestamp extension - Type -1 per the MessagePack spec with all three formats (32, 64, 96 bit)
- std::chrono::system_clock::time_point integration
- glz::msgpack::ext - Direct handling of MessagePack extension values
- Binary buffers - Compact bin* tags for std::vector<std::byte> and similar types
- Partial read/write - JSON pointer support for selective serialization
- File helpers - glz::write_file_msgpack / glz::read_file_msgpack
- Options support - Works with standard Glaze options
To use the new formats, include the appropriate headers:
- CBOR: #include "glaze/cbor.hpp"
- MessagePack: #include "glaze/msgpack.hpp"
Generic JSON Integer Types
New generic JSON types preserve integer precision beyond the 2^53 limit of double. [#2057]
| Type | Number Storage | Use Case |
|---|---|---|
glz::generic |
double |
Fast, JavaScript-compatible (default) |
glz::generic_i64 |
int64_t then double |
Signed integer precision up to 2^63-1 |
glz::generic_u64 |
uint64_t then int64_t then double |
Full unsigned 64-bit range |
:::c++
glz::generic_u64 json{};
std::string buffer = R"({"big_id": 18446744073709551615})";
glz::read_json(json, buffer);
// Maximum uint64_t preserved exactly
assert(json["big_id"].get<uint64_t>() == 18446744073709551615ULL);
Runtime JSON Manipulation
Runtime JSON Pointer Support
JSON pointer paths can now be defined at runtime. [#2150]
:::c++
std::string buffer = R"({"action":"DELETE","data":{"x":10}})";
std::string path = "/action";
auto ec = glz::write_at(path, R"("GO!")", buffer);
// Result: {"action":"GO!","data":{"x":10}}
Runtime Partial Write (write_json_partial)
Specify which fields to serialize at runtime using a whitelist approach. [#2153]
:::c++
my_struct obj{};
std::vector<std::string> keys = {"name", "x"};
std::string buffer;
glz::write_json_partial(obj, keys, buffer);
// Only "name" and "x" fields are serialized
Features:
- Output key order matches input container order
- Works with std::vector<std::string>, std::vector<std::string_view>, std::array, etc.
- Supports standard Glaze options like prettify
Runtime Exclude Write (write_json_exclude)
Specify which fields to exclude at runtime using a blacklist approach. [#2154]
:::c++
my_struct obj{};
std::vector<std::string> exclude = {"password", "internal_id"};
std::string buffer;
glz::write_json_exclude(obj, exclude, buffer);
// All fields except "password" and "internal_id" are serialized
Networking Improvements
Templated HTTP Router
basic_http_router is now templated for custom handler types. [#2151]
:::c++
// Use custom handler types with the HTTP router
glz::basic_http_router<MyCustomHandler> router;
Additional Improvements
rawoption support fortime_point- Serialize time points as raw integer values [#2147]- Documentation improvements - Added
simple_enumcallout and updated documentation website links
Fixes
- Fixed
rawandraw_stringcombined options - Correct behavior when both options are specified [#2148] - MSVC compatibility fix - Resolved build issues on MSVC [#2158]
Full Changelog: https://github.com/stephenberry/glaze/compare/v6.3.0...v6.4.0