From d6f38f157da94b2db2b5a8d88cd2758fd4e49778 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Tue, 21 Mar 2023 16:27:54 +0000 Subject: [PATCH] Add a sentence about what canonical JSON is (#1468) Signed-off-by: Stuart Mumford --- changelogs/appendices/newsfragments/1468.clarification | 1 + content/appendices.md | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/appendices/newsfragments/1468.clarification diff --git a/changelogs/appendices/newsfragments/1468.clarification b/changelogs/appendices/newsfragments/1468.clarification new file mode 100644 index 00000000..6f8ab86f --- /dev/null +++ b/changelogs/appendices/newsfragments/1468.clarification @@ -0,0 +1 @@ +Clarify that the term "Canonical JSON" is a specific thing within the matrix specification. diff --git a/content/appendices.md b/content/appendices.md index dc3ced66..446e709a 100644 --- a/content/appendices.md +++ b/content/appendices.md @@ -83,7 +83,11 @@ object. ### Canonical JSON -We define the canonical JSON encoding for a value to be the shortest +To ensure that all implementations use the same JSON encoding we define +"Canonical JSON". This should not be confused with other uses of +"Canonical JSON" outside of the specification. + +We define this encoding for a value to be the shortest UTF-8 JSON encoding with dictionary keys lexicographically sorted by Unicode codepoint. Numbers in the JSON must be integers in the range `[-(2**53)+1, (2**53)-1]`.