*Continent · 4 territory*
## Summary
A specification and a changelog entry set out the same rules for canonical JSON: how numbers serialise, how object keys sort, and what gets refused.
## Explanation
- In Neuroverseos-governance:doc:SPEC.md, canonical(v) is the JSON Canonicalization Scheme (RFC 8785) applied after dropping object members whose value is undefined, and an object canonicalises to braces around members joined by commas, sorted by key compared as sequences of UTF-16 code units, each member being the stringified key, a colon, and the canonical value.
- canonical(v) is the JSON Canonicalization Scheme (RFC 8785) applied after dropping object members whose value is undefined.
- An object canonicalises to { + members joined by , + }, members sorted by key comparing keys as sequences of UTF-16 code units (RFC 8785 § 3.2.3), each member…
- In Neuroverseos-governance:doc:SPEC.md, a number canonicalises to the ECMAScript Number::toString shortest round-trip form (1, 0.5, 1e+21, 1e-7, -0 as 0), and NaN and infinities are not JSON and must be refused.
- A number canonicalises to the ECMAScript Number::toString shortest round-trip form (RFC 8785 § 3.2.2.3; 1, 0.5, 1e+21, 1e-7, -0 as 0), and NaN and infinities a…
- In Neuroverseos-governance:doc:SPEC.md, canonical JSON requires a real ECMAScript Number::toString serialiser per RFC 8785 § 3.2.2.3: shortest round-trip digits, plain notation for 10⁻⁷ < |x| < 10²¹, exponent form 1e+21 / 1e-7 outside it, and -0 as 0.
- Canonical JSON requires a real ECMAScript Number::toString serialiser per RFC 8785 § 3.2.2.3: shortest round-trip digits, plain notation for 10⁻⁷ < |x| < 10²¹,…
- In Neuroverseos-governance:doc:SPEC.md, a JCS library that implements the ES serialiser should be used, or the algorithm ported (Ryu/Grisu shortest digits, then ES formatting):.NET — the Org.Webpki.JsonCanonicalizer port of cyberphone's JCS reference; Rust — the serde_jcs crate; Python — the rfc8785 package (Trail of Bits) or jcs.
- A JCS library that implements the ES serialiser should be used, or the algorithm ported (Ryu/Grisu shortest digits, then ES formatting): .NET — the Org.Webpki.…
- In Neuroverseos-governance:doc:SPEC.md, object members are sorted by key as sequences of UTF-16 code units, an ordinal comparison (string.CompareOrdinal in.NET, not a culture-aware sort), not by Unicode scalar and not by UTF-8 bytes, which differ above U+FFFF.
- Object members are sorted by key as sequences of UTF-16 code units (an ordinal comparison: string.CompareOrdinal in .NET, not a culture-aware sort; not by Unic…
- In Neuroverseos-governance:doc:SPEC.md, a string or key holding a lone surrogate is not Unicode text and must be refused with an error, and lone surrogates and non-JSON values are refused (§ 8.1); canonicalJson/fingerprint throw on undefined at the top level, a non-finite number, a lone surrogate, or a non-JSON value (function, symbol, bigint).
- A string or key holding a lone surrogate is not Unicode text and MUST be refused with an error.
- Lone surrogates and non-JSON values are refused (§ 8.1).
- canonicalJson/fingerprint throw on undefined at the top level, a non-finite number, a lone surrogate, or a non-JSON value (function, symbol, bigint).
- In robot-domain-rules-CHANGELOG.md, canonicalJson refuses lone surrogates and non-JSON values (functions, symbols, bigints) with a clear error.
- canonicalJson refuses lone surrogates and non-JSON values (functions, symbols, bigints) with a clear error.
- In robot-domain-rules-CHANGELOG.md, a real ECMAScript Number::toString serialiser is required, with JCS libraries named per language.
- A real ECMAScript Number::toString serialiser is required, with JCS libraries named per language.
- In robot-domain-rules-CHANGELOG.md, SPEC.md § 14 specifies ordinal (UTF-16 code unit) key sort.
- SPEC.md § 14 specifies ordinal (UTF-16 code unit) key sort.
## Threads
- How canonical(v) is defined and how an object's members are laid out and sorted
- canonical(v) is the JSON Canonicalization Scheme (RFC 8785) applied after dropping object members whose value is undefined.
- An object canonicalises to { + members joined by , + }, members sorted by key comparing keys as sequences of UTF-16 code units (RFC 8785 § 3.2.3), each member…
- The number serialiser: shortest round-trip digits, notation boundaries, -0, and refusing NaN and infinities
- A number canonicalises to the ECMAScript Number::toString shortest round-trip form (RFC 8785 § 3.2.2.3; 1, 0.5, 1e+21, 1e-7, -0 as 0), and NaN and infinities a…
- Canonical JSON requires a real ECMAScript Number::toString serialiser per RFC 8785 § 3.2.2.3: shortest round-trip digits, plain notation for 10⁻⁷ < |x| < 10²¹,…
- A real ECMAScript Number::toString serialiser is required, with JCS libraries named per language.
- Refusing lone surrogates and non-JSON values with an error
- A string or key holding a lone surrogate is not Unicode text and MUST be refused with an error.
- Lone surrogates and non-JSON values are refused (§ 8.1).
- canonicalJson/fingerprint throw on undefined at the top level, a non-finite number, a lone surrogate, or a non-JSON value (function, symbol, bigint).
- canonicalJson refuses lone surrogates and non-JSON values (functions, symbols, bigints) with a clear error.
## Consultant
**Where it shows up** — The number output keeps coming up: shortest round-trip digits, plain notation between 10⁻⁷ and 10²¹, exponent form 1e+21 and 1e-7 outside it, and -0 as 0, with JCS libraries named for .NET, Rust and Python.
## Ideas
- A real ECMAScript Number::toString serialiser is needed for canonical JSON, and a JCS library or a port of the algorithm should supply it rather than a platform's default formatting.
- Lone surrogates and non-JSON values should be refused with a clear error rather than serialised.
## Territories
- [[Bevia/World/Territories/Canonical JSON number serialisation and JCS libraries|Canonical JSON number serialisation and JCS libraries]]
- [[Bevia/World/Territories/Refusing lone surrogates and non-JSON values|Refusing lone surrogates and non-JSON values]]
- [[Bevia/World/Territories/Ordinal UTF-16 key sorting of object members|Ordinal UTF-16 key sorting of object members]]
- [[Bevia/World/Territories/RFC 8785 canonical JSON serialization|RFC 8785 canonical JSON serialization]]