{
  "slug": "json-canonicalization-scheme",
  "term": "JSON Canonicalization Scheme",
  "aliases": [
    "JCS",
    "RFC 8785"
  ],
  "definition": "JSON Canonicalization Scheme defines a repeatable UTF-8 representation of constrained JSON data for hashing and signing.",
  "note": "Rules: JCS uses ECMAScript primitive serialization and recursive object-property ordering by UTF-16 code units. Array order stays intact, and Unicode strings are not normalized. RFC 8785 is Informational, not an Internet Standards Track specification. [jcs-rfc]\n\nInput: I-JSON prohibits duplicate object names, unpaired surrogates and Unicode noncharacters. Its interoperability guidance bounds numeric precision; identifiers requiring larger exact integers can use strings. Validation must occur before a parser discards evidence such as duplicate names. [jcs-ijson]\n\nScope: Repeatable output from a particular serializer is insufficient to establish a shared canonical format. Protocol Buffers warns that schema, build and library changes can alter deterministic output. [jcs-protobuf]\n\nUse: Agree on the representation profile and required application fields before comparing hashes. A canonical representation does not authenticate its reference or establish freshness. Selected rule examples distinguish ordering, normalization and input acceptance. [jcs-example]\n\nImplementation trap: Rebuilding an ordinary JavaScript object from sorted keys does not preserve JCS order for array-index names: enumeration places 2 before 10, while UTF-16 comparison places 10 before 2. The linked probe includes a non-index-name control. [jcs-example] [jcs-own-keys]",
  "related": [
    "cbor",
    "i-json",
    "data-serialization",
    "cryptographic-hash"
  ],
  "citations": [
    {
      "id": "jcs-rfc",
      "title": "RFC 8785: JSON Canonicalization Scheme, sections 3.1-3.2.4 and status",
      "url": "https://www.rfc-editor.org/rfc/rfc8785.html",
      "accessed": "2026-11-17"
    },
    {
      "id": "jcs-ijson",
      "title": "RFC 7493: I-JSON numbers, characters and object constraints, sections 2.1-2.3",
      "url": "https://www.rfc-editor.org/rfc/rfc7493.html",
      "accessed": "2026-11-17"
    },
    {
      "id": "jcs-protobuf",
      "title": "Protocol Buffers: Proto Serialization Is Not Canonical",
      "url": "https://protobuf.dev/programming-guides/serialization-not-canonical/",
      "accessed": "2026-11-17"
    },
    {
      "id": "jcs-example",
      "title": "Hesela: JSON canonicalization rule examples in storage integrity",
      "url": "https://hesela.com/analyses/checksums-identity-and-lost-writes/#json-canonicalization",
      "accessed": "2026-11-17"
    },
    {
      "id": "jcs-own-keys",
      "title": "ECMAScript 2025: OrdinaryOwnPropertyKeys",
      "url": "https://tc39.es/ecma262/2025/multipage/ordinary-and-exotic-objects-behaviours.html#sec-ordinaryownpropertykeys",
      "accessed": "2026-11-17"
    }
  ],
  "status": "unknown",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-21",
  "provenance": [
    "Source synthesis of RFC 8785 and I-JSON, with original selected-input examples rather than a full canonicalizer or JCS conformance suite.",
    "The linked examples perform no storage I/O and do not measure durability, corruption frequency or production security."
  ]
}
