Add a sentence about what canonical JSON is (#1468)

Signed-off-by: Stuart Mumford <stuart@cadair.com>
This commit is contained in:
Stuart Mumford 2023-03-21 16:27:54 +00:00 committed by GitHub
parent acb631d3d6
commit d6f38f157d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1 @@
Clarify that the term "Canonical JSON" is a specific thing within the matrix specification.

View file

@ -83,7 +83,11 @@ object.
### Canonical JSON ### 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 UTF-8 JSON encoding with dictionary keys lexicographically sorted by
Unicode codepoint. Numbers in the JSON must be integers in the range Unicode codepoint. Numbers in the JSON must be integers in the range
`[-(2**53)+1, (2**53)-1]`. `[-(2**53)+1, (2**53)-1]`.