{
  "slug": "data-serialization",
  "term": "Data serialization",
  "aliases": [
    "Serialization",
    "Data serialisation",
    "Serialisation"
  ],
  "definition": "Data serialization converts structured values into a sequential text or binary representation for storage or transmission.",
  "note": "Representation: A format defines representable values; an application supplies further meaning and constraints. CBOR separates its generic data model from application-specific models and byte encodings. Successful parsing does not establish application validity. [serialization-cbor]\n\nText and bytes: JSON represents a value as text; UTF-8 is required for exchange outside a closed ecosystem. Binary formats such as CBOR specify bytes directly. Serialization is not transaction serializability, compression or encryption. [serialization-json] [serialization-cbor]\n\nRound trips: Types and values survive only as far as the format and language mapping allow. Python's JSON encoder converts supported non-string dictionary keys to strings, so encoding followed by decoding need not reproduce the original dictionary. [serialization-python-json] Numeric precision also depends on the decoder; JSON permits implementations to limit it. [serialization-json]\n\nByte identity: Whitespace and string escapes can give the same JSON value different bytes. Protocol Buffers' deterministic output is not canonical across schema, build or library changes. A protocol can instead define a deterministic CBOR profile; the chosen rules still matter. [serialization-json] [serialization-protobuf] [serialization-cbor]\n\nRecovery: Preserve the representation version and required interpretation metadata. Decide whether acceptance requires original bytes, decoded values or application invariants; these are different checks. Bound input size and decoder resources for untrusted data. [serialization-cbor]",
  "related": [
    "cbor",
    "i-json",
    "metadata",
    "byte-order",
    "data-integrity",
    "sqlite-serialization",
    "json-canonicalization-scheme",
    "variable-length-integer",
    "zigzag-encoding",
    "base64",
    "base64url",
    "json-text-sequence",
    "newline-delimited-json",
    "protocol-buffers",
    "csv",
    "media-type",
    "file-signature"
  ],
  "citations": [
    {
      "id": "serialization-json",
      "title": "RFC 8259: JSON grammar, numbers, strings and UTF-8 exchange, sections 2, 5, 6, 7 and 8.1",
      "url": "https://www.rfc-editor.org/rfc/rfc8259.html",
      "accessed": "2026-11-17"
    },
    {
      "id": "serialization-cbor",
      "title": "RFC 8949: CBOR data models, deterministic encoding, validity and security, sections 2, 4.2, 5.3 and 10",
      "url": "https://www.rfc-editor.org/rfc/rfc8949.html",
      "accessed": "2026-11-17"
    },
    {
      "id": "serialization-protobuf",
      "title": "Protocol Buffers: Proto Serialization Is Not Canonical",
      "url": "https://protobuf.dev/programming-guides/serialization-not-canonical/",
      "accessed": "2026-11-17"
    },
    {
      "id": "serialization-python-json",
      "title": "Python 3.12: json.dumps, supported dictionary keys and round-trip behavior",
      "url": "https://docs.python.org/3.12/library/json.html#json.dumps",
      "accessed": "2026-11-17"
    }
  ],
  "status": "unknown",
  "advantages": [],
  "limitations": [],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-21",
  "provenance": [
    "Source synthesis with selected JSON worked examples, not a general canonicalization algorithm or a storage benchmark.",
    "The recovery checklist is an engineering inference from format and interpretation requirements, not a guarantee made by every serializer."
  ]
}
