Skip to content
Discussion options

You must be logged in to vote

If you use a std::map then keys will be ordered. Likewise glz::json_t orders keys and uses a std::map underneath.

Using a glz::meta for your structs allows you to define a canonical order even if the fields aren't in that order. But, it requires writing out a glz::meta for all your structs.

It would not be too difficult to write out ordered keys for purely reflected structs. This is not currently supported and I'll look into adding a compile time option to enable this.

For now, just order the keys how you like manually in a glz::meta or use a std::map or glz::json_t

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@StormLord07
Comment options

@stephenberry
Comment options

@StormLord07
Comment options

Answer selected by StormLord07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants