HeadlinesBriefing favicon HeadlinesBriefing.com

TSON: Immutable, hash‑pinned schema superset of JSON

Hacker News •
×

TSON (Typed Schema Object Notation) is a Unicode‑first superset of JSON that pairs immutable, hash‑pinned schemas with the data itself. A document names its schema, the schema names its meta‑schema, and a single hash verifies the chain, giving a self‑contained, tamper‑evident contract. This eliminates scattered validation code, a point made by Google, Microsoft, and Zalando.

Fields are required by default, with ~ for defaults, = for pinned values, and ? for optional fields, giving five explicit states. Schemas are maps written in a compact, readable grammar; for example, a person record combines with an employee record that inherits department and level, where level is an enum with a default. The tson-java tool offers an init‑example command that creates a schema and data pair, and a validate command that reports every problem with its path.

Because schemas are immutable, adding a new required field creates a new version with a new hash, allowing multiple versions to coexist and migrations to be computed as precise structural diffs. TSON forbids silent overrides, treats unknown fields as errors, and supports arbitrary‑precision numbers and multi‑line strings, making it a robust, readable alternative to traditional JSON schemas, as highlighted in the 18‑article research series.