The ETA’s canonical serialization of a document
Before hashing, the document becomes one line of text by fixed rules: field names upper-cased in quotes, values as they are, and the array name before each element.
The "Document Serialization Approach" says serialization starts at the document root and follows the order in which elements appear. Each field name is written in culture-invariant upper case within double quotes, and each simple value within double quotes exactly as it came, unprocessed: 0.0 stays 0.0, not 0 or 0.00.
In JSON an array’s name is written once before it and again before each element; in XML each element is preceded by its own singular name. Spaces and line breaks between elements do not matter, since only names and values go in. The text is then hashed with SHA-256.
In practice, the JSON sent and the text hashed must carry the same numbers character for character, or the hash will differ.
In JooDax
BuiltJooDax builds the document as a tree that keeps field order and each number’s text, so the JSON and the canonical form come from the same tree. A test matches the array example character for character, and another checks that a quote inside a value stays escaped, so two different documents never serialize alike.
crates/jdx-einvoice-eg/src/lib.rs; crates/jdx-einvoice-eg/src/tests.rs
Questions and answers
What does an array look like serialized?
The ETA’s JSON example for the taxable items array: "TAXABLEITEMS""TAXABLEITEMS" then item 1, then "TAXABLEITEMS" then item 2, and so on.
Related pages
Related concepts
- The UUID chain: how each receipt links to the one beforeEach receipt’s UUID is the SHA-256 of its content, and that content includes the previous receipt’s UUID from the same POS, so the receipts form a chain from which no link vanishes unnoticed.
- Signing the Egyptian e-invoice (CAdES-BES)The issuer signs the invoice with a CAdES-BES signature over the hash of its serialization, using a certificate issued to it and held on a cryptographic device or an e-seal.
E-receipts and e-invoices in Egypt
Sources
- Document Serialization Approach — Egyptian Tax Authority (ETA) – eInvoicing & eReceipt SDK
Checked on: 4 November 2026. What concerns JooDax is taken from the programs’ own code.