Data format interoperability 2026-11-05
Data format interoperability means that independent producers and consumers can exchange data with an agreed interpretation. Sharing a syntax is one part of that agreement; character encoding, supported values and handling of ambiguous inputs also matter. Serialization and deserialization must preserve the distinctions the application needs.[ref]
The JavaScript Object Notation (JSON) Data Interchange Format. RFC8259, §1.3 interoperability motivation; §§4,6 and8.1
Consider the original JSON input
{"mode":"fast","mode":"safe"}. RFC8259 says object member names should be unique and warns that duplicate-name handling differs. In Python, the default json.loads result is {'mode': 'safe'}. The same decoder with object_pairs_hook=list instead returns [('mode', 'fast'), ('mode', 'safe')], preserving both pairs.[ref]The JavaScript Object Notation (JSON) Data Interchange Format. §4: object names and duplicate-name interoperability
[ref]The text has not changed, yet one consumer retains one value and another retains both occurrences. Re-encoding the default dictionary cannot recover the discarded occurrence. A consumer can instead use a hook that rejects a repeated name, making the ambiguity explicit before the application acts on it.
An exchange contract can therefore require unique names and a shared duplicate-rejection policy, as well as a character encoding such as UTF-8. That is a stronger agreement than merely saying that both programs support JSON. Data validation then checks application-level requirements on the agreed decoded representation.
Fixed-width length field 2026-11-05
A fixed-width length field uses a fixed number of encoded bytes to state a payload length. The payload itself can vary in size. For an unsigned -byte field in big-endian endianness, bytes representThe format must additionally define the length unit, permitted range and whether headers count toward it. TLS uses unsigned, network-order integers and gives variable-length vectors a prefix wide enough for their declared maximum; its vector length counts bytes, not elements.[ref]
For an original two-byte length-prefixed encoding, prefix
02 01 means payload bytes in big-endian order. The complete field then occupies bytes. The same two prefix bytes would mean under little-endian interpretation, changing the boundary of every following field. The byte order is therefore part of the serialization, not a display preference.A two-byte field can represent at most ; a format permitting payload lengths only up to must reject larger encoded values even though they fit the field. Conversely, a -byte payload needs prefix
01 2c under this convention. Truncating it to one byte would declare only bytes. A format change cannot be implemented by silently discarding high-order bits.Length-prefix validation before allocation checks the declared range and available input before reserving space or consuming the payload. A complete decoder also specifies how truncation and trailing bytes are handled. Byte count and character count differ for encodings such as UTF-8. A length prefix supplies boundaries; a field's role or type may still need binding through cryptographic domain separation.
JSON 2026-11-05
JSON, short for JavaScript Object Notation, is a textual data interchange format used for serialization. Its values are objects, arrays, strings, numbers, Boolean values and
null. Object member names are strings; array elements are ordered. A complete JSON text may represent a single value, including a number or string.[ref]The format's syntax and an implementation's numerical precision are separate. For an original example, consider
{"n":9007199254740993}. A JavaScript call to JSON.parse produces a Number whose decimal value is 9007199254740992; the requested integer has rounded to in the double-precision floating-point format. The same input decoded by Python's default json.loads retains the integer 9007199254740993 exactly.Encoding the digits as
{"n":"9007199254740993"} preserves them as a string in both examples, but changes the represented type. Any later numerical interpretation needs an agreed rule. RFC8259 identifies the integer interval for exact agreement with commonly used numerical implementations; it does not restrict valid JSON numerals to that interval.[ref]The JavaScript Object Notation (JSON) Data Interchange Format. §6: number magnitude, precision and interoperability
Length-prefixed encoding 2026-11-05
A length-prefixed encoding represents a variable-size field by writing a length before its payload. The length's units, width, endianness, permitted range and inclusion or exclusion of the prefix itself are part of the serialization format. For example, the Transport Layer Security presentation language counts vector lengths in bytes and encodes variable-length vectors with a length field whose width follows the specified upper bound.[ref]
An original two-field format uses one unsigned byte for each payload length:Here counts payload bytes and is concatenation. The ASCII fields
ab and c give 02 61 62 01 63, while a and bc give 01 61 02 62 63. Bare concatenation would give 61 62 63 in both cases. This distinction is useful when a cryptographic hash function or message authentication code must commit to two separate fields.The encoding is an injective function on its stated input set. Read the first length byte , then exactly bytes for ; read the next length byte , then exactly bytes for . This reconstructs both fields uniquely. For a complete two-field record, require that no bytes remain. Missing bytes, absent length fields or forbidden lengths are rejected rather than silently reinterpreted. The proof depends on these parsing rules, not merely on putting some number before the data.
A fixed-width length field also imposes a representable limit: 256 payload bytes cannot be encoded by the one-byte scheme above. Truncating that length modulo 256 would make the parser see zero and destroy the intended format. A larger format must specify a larger prefix or a different encoding.
Finally, byte count and text-character count can differ. The text
é has two bytes c3 a9 in UTF-8, so its one-byte length prefix here is 02. A length prefix provides boundaries; cryptographic domain separation may additionally require a field type, role label or protocol version to distinguish records with different meanings. Serialization 2026-11-05
Serialization maps structured program data into a representation that can be stored or transmitted, often a sequence of bytes. Deserialization reconstructs data according to that format. A useful format must specify which values and distinctions it preserves; writing an object's display text is not automatically a reversible encoding. JSON is one textual interchange format, with ordered arrays and objects whose member names are strings.[ref]
In Python, let
value = {"coords": [2, 5], "ready": True}. Calling json.dumps(value, sort_keys=True, separators=(",", ":"), allow_nan=False) produces {"coords":[2,5],"ready":true}. Encoding this string with UTF-8 gives 29 bytes; json.loads reconstructs a value equal to value. Here serialization connects a nested runtime value, text and an explicit character encoding.[ref]Python 3.14 documentation. json module, Basic Usage; JSONEncoder and JSONDecoder conversion tables
The preservation claim is deliberately specific. If
coords originally contains the tuple (2, 5), the default JSON round trip produces a list instead. Equality of the chosen first example therefore proves neither preservation of every runtime type nor preservation of object identity. Format design requires deciding which such distinctions matter. T. Bray 2026-11-05
T. Bray is credited as editor of RFC 8259, the 2017 specification of JSON as a format for serialization of structured data. The document makes both the grammar and data format interoperability requirements explicit: a shared notation is most useful when independent implementations agree on what it means.[ref]
The JavaScript Object Notation (JSON) Data Interchange Format. Editor byline; Sections1–2: purpose, data values and grammar
One concrete example is duplicate object names. The invented text
{"x":1,"x":2} fits the object grammar, but the specification recommends unique names because receiving implementations can handle duplicates differently. Some keep the last pair, some reject the input and some expose all pairs. A parser accepting text and two applications agreeing on its interpretation are different conditions.[ref]The JavaScript Object Notation (JSON) Data Interchange Format. Section4: object grammar, unique-name recommendation and differing receiver behavior
The specification also requires UTF-8 for exchanged JSON outside a closed ecosystem. Character encoding, syntax and agreement on values thus contribute separately to reliable interchange.[ref]
The JavaScript Object Notation (JSON) Data Interchange Format. Section8.1: network interchange encoding
This work illustrates a contribution through precise specification: identifying where superficially similar implementations can disagree and stating requirements that make exchange predictable. The initial-only header retains the document's editor byline.
Portrait page: www.tbray.org/ongoing/misc/Tim
TeX format file 2026-11-05
A TeX format file stores initialized internal structures for a TeX format, usually under a
.fmt filename. Loading it reconstructs prepared definitions and related state more quickly than rereading the initialization input. Creating it uses the initialization facility and the \dump command.[ref]TeX by Topic by Victor Eijkhout. §33.1.2, pp.257–258: compact internal dump, load and initialization
This is an example of serialization. Suppose an initialization input defines
\def\banner{First} and its state is saved. Changing the original input to define Second does not by itself replace the already saved state. The format must be regenerated, or the loaded definition explicitly changed, for subsequent processing to use that new initialization.A loaded TeX format file initializes future document processing. The document can then add further TeX macros, change parameters and request mathematical typesetting. The relevant implementation must be able to read the saved representation; a
.fmt suffix alone does not establish compatibility between different implementations.