Sort json keys

This commit is contained in:
Nathan McCarty 2025-02-07 02:02:40 -05:00
parent 07a9b29c00
commit 9a87e7825a
6 changed files with 28 additions and 28 deletions

View file

@ -62,10 +62,10 @@ class PostDB {
mkdir $posts-dir unless $posts-dir.e;
# Write out metadata
# TODO: Track changes and only write changed files
$dir.add('meta.json').spurt: $!meta.to-json;
$dir.add('meta.json').spurt: $!meta.to-json(:sorted-keys);
# Write out posts (ids are the filename)
for %!posts.kv -> $key, $value {
$posts-dir.add("$key.json").spurt: $value.to-json;
$posts-dir.add("$key.json").spurt: $value.to-json(:sorted-keys);
}
}