Unit content
Structured data and schemas
Data becomes easier to validate, query and exchange when repeated pieces of information follow a known structure.
A record groups related fields. For example,
name: Ada
age: 36
active: true
contains three fields with different meanings and value types.
Schemas
A schema describes the expected structure of data: which fields exist, what kinds of values they hold and which constraints apply.
For example, a user record might require a unique identifier and a name while allowing an optional email address.
Structure and serialization are different
The same logical record can be serialized in different formats such as JSON, CSV rows or database columns.
A serialization format determines how data is represented as text or bytes. A schema determines what the represented values mean and how they fit together.
Validation
Incoming data can be checked against its schema before the rest of a program relies on it. Validation can reject missing required fields, values of the wrong type or values outside permitted ranges.
Collections of records
When many records share a schema, software can process them systematically: select fields, compare records, group them and store them in tables or other structured collections.
Schemas turn informal data conventions into explicit structure that other systems can depend on.