Imported Types Become Local Types
Use $import or $importdefs to copy published types into a local namespace, with absolute import URIs and explicit shadowing.
JSON Structure is a data structure definition language that enforces strict typing, modularity, and determinism.
Welcome to the JSON Structure blog. Here we explore practical applications, dive deeper into features, and share insights about using JSON Structure effectively.
Use $import or $importdefs to copy published types into a local namespace, with absolute import URIs and explicit shadowing.
Use definitions as a case-sensitive namespace hierarchy for reusable types, including types that share a local name but not a meaning.
Code generation adapts a JSON Structure choice to the type system, serialization model, and artifact boundaries of each target.
Non-discriminated unions use first-match semantics, so branch order is part of the type contract rather than a cosmetic choice.
Model several concrete object variants that share an abstract base through $extends and use an explicit selector.
In a JSON Structure tagged choice, a one-property wrapper names the selected payment method. Consumers select the variant from that tag instead of inferring it from the value's shape.
A JSON Structure set maps to native set-like types in several generated targets. Other projections require explicit uniqueness checks and an ordering policy when byte order matters.
Use a closed object for schema-defined fields and a separate map for runtime-defined keys. A new object field requires a schema revision; a new map key does not.
The nested-array form of `required` selects exactly one complete property set. A contact record shows how JSON Structure evaluates the alternatives.
Named tuple positions preserve longitude and latitude in generated APIs while the JSON wire format remains an array.
Structurize turns observed records into a useful JSON Structure draft. Domain knowledge then refines the inferred types, presence rules, and value domains.
Array, set, and map encode different collection contracts. One playlist schema shows how order, uniqueness, and dynamic keys belong in the type.
JSON Structure defines binary values together with their text encoding, compression, and media type, so consumers know how to recover the payload.
JSON Structure declares date, time, datetime, and duration as distinct types with RFC 3339 representations instead of treating them as decorated strings.
Keep one JSON Structure schema as the source contract and project disposable documentation, protocols, database definitions, and code from it.
JSON Structure separates exact base-10 decimal values from binary floating point and carries precision and scale in the data definition.
JSON Structure gives integers an explicit width and signedness, from int8 to uint128, while preserving large values safely in JSON strings.
JSON Structure defines the data model behind a JSON document, so the same Customer contract can drive validation, code, storage, and interchange.
Two schemas can agree that a member is a double in metres and still describe water level above a tide gauge and height above an ellipsoid. An IETF Internet-Draft defines optional schema annotations for the missing semantic facts. A common reference-and-kind shape can bind coordinate systems, color profiles, weighting curves, code registers, spectral bands, and vector frames. Component lists also state which members supply ordered axes or channels. The annotations add no fields to conforming instance documents.
JSON Structure is a strongly typed schema language for data models that map cleanly to programming languages, databases, APIs, and JSON.
Structurize's json2s command infers JSON Structure schemas from JSON and JSONL samples for validation, code generation, and documentation.