While calling std.json: toPrettyString I want to have an option to get the keys sorted. An option "sorted" could be added to JSONOptions.
Use case: I automatic create and update a JSON file. A user also updates this file manually. To have a stable order of the keys, the keys should always be stored in a sorted way.
This is good for the user and also for git diffs.
Comment #1 by dlang-bugzilla — 2024-10-21T11:13:00Z
std.json has started to unconditionally sort the keys of JSON objects in its output a while ago. (It's an improvement over letting the order be dictated by the implementation details of the D associative array implementation in Druntime).
Comment #2 by robert.schadek — 2024-12-01T16:34:31Z