Skip to content

Releases: stephenberry/glaze

v6.0.2

06 Nov 20:02

Choose a tag to compare

New Features

  • skip_if runtime value skipping in #2029

skip_if documentation

struct user_settings_t {
    std::string theme = "light";
    int volume = 50;
};

template <>
struct glz::meta<user_settings_t> {
    template <class T>
    static constexpr bool skip_if(T&& value, std::string_view key, const 
glz::meta_context&) {
        using V = std::decay_t<T>;
        if constexpr (std::same_as<V, std::string>) {
            return key == "theme" && value == "light";
        }
        else if constexpr (std::same_as<V, int>) {
            return key == "volume" && value == 50;
        }
        return false;
    }
};
  • REPE to/from JSON RPC 2.0 in #2026

Improvements

  • Support for nullable_value_t with BEVE in #2021
  • Prevent Clang missing braces warnings in #2024

Fixes

Full Changelog: v6.0.1...v6.0.2

v6.0.1

22 Oct 13:53

Choose a tag to compare

Improvements

Fixes

  • Checking for Opts.comments when skipping ws to fix JSONC parse issue by @stephenberry in #2005
  • Fixed read_constraint optional handling with missing-key option by @stephenberry in #2010

Full Changelog: v6.0.0...v6.0.1

v6.0.0

10 Oct 16:38

Choose a tag to compare

Breaking Changes

  • Removed the experimental language interop from v5.6.0. All include/glaze/interop/* headers, the src/interop target, and associated tests have been deleted, and the glaze_BUILD_INTEROP CMake option no longer exists. #1976
  • Renamed the dynamically typed glz::json_t to glz::generic (include/glaze/json/generic.hpp). #1984
  • Streaming HTTP clients now surface server-side failures as category-aware std::error_code instances via glz::http_status_category(). Handlers that assumed generic networking errors should read the status code with glz::http_status_from.

Highlights

Reflection & Metadata

glz::meta::modify

  • New glz::meta<T>::modify, letting you rename fields, add aliases, or append computed keys without re-declaring the full object (include/glaze/core/meta.hpp). See modify reflection guide.

Self Constraints

  • Validate the aggregate after deserialization by attaching a glz::self_constraint, which runs once all members have been populated and reports friendly messages on failure (include/glaze/core/constraint.hpp).
struct cross_constrained
{
   int age{};
   std::string name{};
};

template <>
struct glz::meta<cross_constrained>
{
   using T = cross_constrained;

   static constexpr auto combined = [](const T& v) {
      return ((v.name.starts_with('A') && v.age > 10) || v.age > 5);
   };

   static constexpr auto value = object(&T::age, &T::name);
   static constexpr auto self_constraint = glz::self_constraint<combined, "Age/name combination invalid">;
};

glz::as_array wrapper

  • Use glz::as_array<&T::member> when declaring metadata to serialize/deserialize aggregate members as positional arrays while keeping struct storage.

Improvements

Fixes

Full Changelog: v5.7.2...v6.0.0

v5.7.2

23 Sep 18:37

Choose a tag to compare

Improvements

Fixes

Full Changelog: v5.7.1...v5.7.2

v5.7.1

10 Sep 19:26

Choose a tag to compare

Improvements

  • Faster BEVE compile time known key writing in #1933
  • Prettify support for whitespace by @stephenberry in #1934
    • This enables prettified glz::raw_json to be used within glz::pretiffy_json calls

Fixes

Full Changelog: v5.7.0...v5.7.1

v5.7.0

04 Sep 13:49

Choose a tag to compare

Better Support for Raw Pointer and Pure Reflection

  • Raw pointers now follow the skip_null_members option for reflected structs
  • Fixes a segfault for raw pointers with purely reflected structs (now skips or writes out null based on options)
  • Better support for pure reflection and raw pointers by @stephenberry in #1927

Improvements

  • New glz::has_reflect concept to check if glz::reflect<T> is applicable in #1929
  • Variant tag validation for auto-deduced structs by @stephenberry in #1919
  • Support for read_binary_untagged with static tags by @stephenberry in #1928
  • Support for tagged variants with default case by @stephenberry in #1921

Glaze now supports a default/catch-all variant type by making the ids array shorter than the number of variant alternatives. The first unlabeled type (without a corresponding ID) becomes the default handler for unknown tags.

See Variant Handling for more documentation

Fixes

Full Changelog: v5.6.1...v5.7.0

v5.6.1

28 Aug 20:27

Choose a tag to compare

Better std::variant support

Read the updated documentation for handling variants

Other Improvements

Full Changelog: v5.6.0...v5.6.1

v5.6.0

19 Aug 13:11

Choose a tag to compare

New Features

C shared library interop (FFI) using Glaze and modern C++ reflection in #1890

Documentation: https://stephenberry.github.io/glaze/interop/

Key transformers in #1889

struct my_struct {
   int user_id = 123;
   std::string first_name = "John";
};

// Apply camelCase transformation
template <>
struct glz::meta<my_struct> : glz::camel_case {};

// JSON output: {"userId":123,"firstName":"John"}

8 Naming Convention Transformers:
camel_case: snake_case → camelCase
pascal_case: snake_case → PascalCase
snake_case: camelCase/PascalCase → snake_case
screaming_snake_case: any → SCREAMING_SNAKE_CASE
kebab_case: any → kebab-case
screaming_kebab_case: any → SCREAMING-KEBAB-CASE
lower_case: any → lowercase
upper_case: any → UPPERCASE

Zero Runtime Overhead: All transformations occur at compile-time through constexpr functions

Use smallest object when encountering ambiguous variants in #1903

Previously, when multiple variant types had overlapping fields (e.g., one type being a subset of
another), Glaze would fail with error_code::no_matching_variant_type. This was particularly
problematic for common patterns like:

  • Progressive detail levels (BasicInfo → DetailedInfo → FullInfo)
  • Optional field patterns where simpler types are subsets of complex ones
  • API versioning where newer types extend older ones

The resolution strategy:

During JSON parsing, when multiple object types in a variant match all their required fields, the type with the minimum field count is automatically selected. This ensures the most specific/appropriate type is chosen.

Improvements

Full Changelog: v5.5.5...v5.6.0

v5.5.5

04 Aug 19:13

Choose a tag to compare

Improvements

Fixes

Full Changelog: v5.5.4...v5.5.5

v5.5.4

16 Jul 17:25

Choose a tag to compare

Improvements

Fixes

Full Changelog: v5.5.3...v5.5.4