From 242a1e0ad680402959555adc8dabcd436cc4f91d Mon Sep 17 00:00:00 2001 From: Bendik Aagaard Lynghaug Date: Thu, 24 Sep 2026 20:44:37 +0200 Subject: [PATCH] The keys come out in the order they were written A page is read by the people who own it, and serde_json sorts keys, so every file put `name` at the bottom under `action` and `consequence`. With preserve_order the file reads the way it was built: name, then description, then what the card does. Co-Authored-By: Claude Opus 5 (1M context) --- Cargo.lock | 1 + Cargo.toml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index d96719b..30ddbbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -112,6 +112,7 @@ version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" dependencies = [ + "indexmap", "itoa", "memchr", "serde", diff --git a/Cargo.toml b/Cargo.toml index 7da1273..6d411d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,8 @@ description = "Generates a portal content repo from a business intake, held to p [dependencies] anyhow = "1" serde = { version = "1", features = ["derive"] } -serde_json = "1" +# preserve_order: a page is read by the people who own it, so the keys +# come out in the order they were written (name, then description, then +# the rest), not sorted with `name` at the bottom. +serde_json = { version = "1", features = ["preserve_order"] } serde_yaml = "0.9"