Fairspec Table Schema
Updated Nov 12, 2026
| Authors | Evgeny Karev |
|---|---|
| Profile | https://fairspec.org/profiles/latest/table-schema.json |
Fairspec Table Schema is a simple JSON-based format that defines Table Schema to describe a class of tabular data resources. A Table Schema is a JSON Schema 2020-12 schema of one row, restricted to the subset that describes one typed column per property. When expedient, this specification aims to be structurally compatible with the Data Package standard.
Language
The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL in this document are to be interpreted as described in RFC 2119.
Descriptor
A Fairspec Table Schema is a JSON resource that MUST be an object compatible with the Table Schema structure outlined below.
Table Schema
A top-level descriptor object defining a schema of tabular data resources. It MAY have the following properties (all optional unless otherwise stated):
$schema [#profile]
External Path to one of the officially published Fairspec Table Schema profiles or https://json-schema.org/draft/2020-12/schema with default value https://fairspec.org/profiles/latest/table-schema.json. A Table Schema declaring the JSON Schema dialect MUST be validated as one declaring the default profile.
For example for version X.Y.Z of the profile:
{
"$schema": "https://fairspec.org/profiles/X.Y.Z/table-schema.json"
}title
An optional human-readable title for the table schema. It MUST be a string.
For example:
{
"title": "Experimental Measurements Dataset"
}description
An optional detailed description explaining the purpose and contents of the table schema. It MUST be a string.
For example:
{
"title": "Experimental Measurements Dataset",
"description": "Temperature and pressure measurements collected during chemical reaction experiments performed in laboratory conditions."
}properties
An object defining the schema for table columns. Each key represents a column name, and its value MUST be a valid Column definition.
A key matches a column of the data whose name is equal to it character for character: names are case-sensitive and never trimmed, so ID in the data is not the column id. The same holds for every column name this specification lists, such as in required or the keys.
For example, for a simple table with different column types:
{
"properties": {
"id": {
"type": "integer",
"minimum": 1
},
"name": {
"type": "string",
"maxLength": 100
},
"email": {
"type": "string",
"format": "email"
},
"active": {
"type": "boolean"
}
}
}required
An optional list of column names that are required to present. Each item MUST be a string matching a key in the properties object.
For example, to require specific columns:
{
"required": ["experiment_id", "temperature", "pressure"],
"properties": {
"experiment_id": {
"type": "integer"
},
"temperature": {
"type": "number"
},
"pressure": {
"type": "number"
},
"notes": {
"type": "string"
}
}
}allRequired
An optional boolean flag indicating whether all columns defined in properties are required. When set to true, every column MUST be present in the data. It MUST be a boolean value.
For example, to require all columns:
{
"allRequired": true,
"properties": {
"experiment_id": {
"type": "integer"
},
"temperature": {
"type": "number"
},
"pressure": {
"type": "number"
}
}
}primaryKey
An optional array of column names that form the table's primary key. The combination of values in these columns MUST uniquely identify each row. At least one column name MUST be specified if this property is present, and every name MUST be a column in properties.
A primary key column MUST be present in the data, as if it were required, and its cells MUST NOT be null, even where the column's type allows null.
Keys compare the typed values of their cells, as parsed by the column's type, not the text the file holds: in a number column 1.0 and 1 are the same value, and in a DateTime column 2024-01-01T12:00:00+02:00 and 2024-01-01T10:00:00Z are. This holds for primaryKey, uniqueKeys and foreignKeys alike.
For example, with a single-column primary key:
{
"primaryKey": ["experiment_id"],
"properties": {
"experiment_id": {
"type": "integer"
},
"measurement": {
"type": "number"
}
}
}For example, with a composite primary key:
{
"primaryKey": ["sample_id", "timestamp"],
"properties": {
"sample_id": {
"type": "string"
},
"timestamp": {
"type": "string",
"format": "date-time"
},
"value": {
"type": "number"
}
}
}uniqueKeys
An optional array of unique key constraints. Each unique key is an array of column names whose combined values MUST be unique across all rows in the table. Each unique key array MUST contain at least one column name, and every name MUST be a column in properties.
A row in which any of the key's columns is null is not compared, as in SQL: such rows never conflict with each other or with any other row. Values are compared as typed values, as for primaryKey.
For example, with multiple unique constraints:
{
"uniqueKeys": [["email"], ["username"], ["department", "employee_number"]],
"properties": {
"email": {
"type": "string",
"format": "email"
},
"username": {
"type": "string"
},
"department": {
"type": "string"
},
"employee_number": {
"type": "integer"
}
}
}foreignKeys
An optional array of foreign key constraints that define relationships between this table and other tables. Each foreign key specifies local columns and their reference to columns in another resource (identified by resource name in the dataset context). Both columns lists MUST name at least one column, and they MUST have the same length: the n-th local column refers to the n-th referenced column. Every local column MUST be a column in properties.
A row in which any of the local columns is null is not checked against the reference, as SQL's MATCH SIMPLE: a composite key with one null part is skipped whatever its other parts hold. Every other row MUST have its columns values present in the referenced columns of some row of the referenced resource, compared as typed values, as for primaryKey. The referenced values need not be unique: a value present in several referenced rows satisfies the key.
Each local column and the column it refers to MUST have the same column type, a null in either column's type array aside (["integer", "null"] matches "integer"), with one exception: Integer, Number and Decimal columns MAY refer to one another, and their values compare by numeric value, so 1, 1.0 and 1.00 are the same key. Any other pair of differing types MUST be reported as a metadata error at /foreignKeys/<i>, the foreign key's position in the array, and that foreign key is not checked against the data. Columns of the same type compare their typed values, as above.
The referenced resource MAY be any table resource of the dataset, whether its data is a file, inline or multipart. A reference.resource naming a resource that is not a table, such as one described by a Data Schema, MUST be reported as a metadata error.
For example, referencing another resource:
{
"foreignKeys": [
{
"columns": ["customer_id"],
"reference": {
"resource": "customers",
"columns": ["id"]
}
}
],
"properties": {
"order_id": {
"type": "integer"
},
"customer_id": {
"type": "integer"
},
"amount": {
"type": "number"
}
}
}For example, with a self-reference (omitting resource):
{
"foreignKeys": [
{
"columns": ["parent_id"],
"reference": {
"columns": ["id"]
}
}
],
"properties": {
"id": {
"type": "integer"
},
"parent_id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}For example, with a composite foreign key:
{
"foreignKeys": [
{
"columns": ["supplier_id", "product_code"],
"reference": {
"resource": "catalog",
"columns": ["supplier_id", "code"]
}
}
],
"properties": {
"supplier_id": {
"type": "integer"
},
"product_code": {
"type": "string"
}
}
}additionalProperties
An optional boolean stating whether the data MAY have columns that properties does not list. It defaults to true. When false, every such column is an error. A schema value, which JSON Schema allows, is not supported and MUST be rejected.
For example, to allow only the listed columns:
{
"additionalProperties": false,
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
}
}
}missingValues
An optional list of values that represent missing or null data across all columns in the table. Each item can be either a simple value or an object with value and label properties for documentation purposes. The values type MUST be "string" or "integer".
A cell is missing when it equals an item literally, before any type conversion and without coercion: a string matches a cell the format delivers as text, character for character, and an integer matches a cell the format delivers as a number. A text format such as CSV delivers every cell as text, so its missing values are written as strings ("-999", not -999). A column's own missingValues apply in addition to these.
For example, with simple values:
{
"missingValues": ["NA", "N/A", "", -999]
}For example, with labeled values:
{
"missingValues": [
{ "value": "NA", "label": "Not Available" },
{ "value": "NR", "label": "Not Recorded" },
{ "value": -999, "label": "Sensor Error" }
]
}For example, with mixed values:
{
"missingValues": ["NA", { "value": -999, "label": "Sensor Error" }]
}Column
A column definition that specifies the data type, constraints, and metadata for a table column. The schema is routed based on the type property and optionally the format property to determine which specific column type applies.
type
The data type of the column. It MUST be one of the following values:
boolean- True/false valuesinteger- Whole numbersnumber- Numeric valuesstring- Text valuesarray- Array/list valuesobject- Object/dictionary values
As in JSON Schema, the type MAY also be an array of these values with unique items, in any order. A column allows missing values when the array includes null:
"integer"and["integer"]are the same type["integer", "null"]and["null", "integer"]- Whole numbers or missing values["integer", "number"], with or withoutnull, isnumber, since every integer is a number
Any other array, holding two or more of the values above, MUST be rejected. A column without type is Unknown.
Metadata example:
{
"properties": {
"age": {
"type": "integer"
},
"title": {
"type": ["string", "null"]
}
}
}Data example:
age
25
32
18title [#column-title]
An optional human-readable title for the column. It MUST be a string.
Metadata example:
{
"properties": {
"temp_c": {
"type": "number",
"title": "Temperature (Celsius)"
}
}
}Data example:
temp_c
23.5
-10.2
98.6description [#column-description]
An optional detailed description of the column. It MUST be a string.
Metadata example:
{
"properties": {
"pressure": {
"type": "number",
"description": "Atmospheric pressure measured in hectopascals (hPa) at the time of observation."
}
}
}Data example:
pressure
1013.25
1020.50
995.30rdfType
An optional property that provides a richer, "semantic" description of the type of data in a column. The value MUST be the URI of a RDF Class, that is an instance or subclass of RDF Schema Class object.
Metadata example:
{
"properties": {
"country": {
"type": "string",
"rdfType": "http://schema.org/Country"
}
}
}Data example:
country
US
UK
DE
FRenum
An optional array of allowed values for the column. The values MUST match the column's type.
For example, with string values:
{
"properties": {
"status": {
"type": "string",
"enum": ["pending", "active", "completed", "cancelled"]
}
}
}For example, with integer values:
{
"properties": {
"priority": {
"type": "integer",
"enum": [1, 2, 3, 4, 5]
}
}
}Data example:
status
pending
active
completed
cancelledconst
An optional constant value for the column. The value MUST match the column's type.
For example, with string values:
{
"properties": {
"status": {
"type": "string",
"const": "pending"
}
}
}For example, with integer values:
{
"properties": {
"priority": {
"type": "integer",
"const": 1
}
}
}Data example:
status
pending
pendingdefault
An optional default value for the column. The value MUST match the column's type. This property is for documentation purpose and it is not used to fill missing values.
Metadata example:
{
"properties": {
"status": {
"type": "string",
"default": "pending",
"missingValues": ["N/A"]
}
}
}Data example:
status
done
N/Aexamples
An optional array of example values for the column. The values MUST match the column's type and can be used for documentation, testing, or generating sample data.
Metadata example:
{
"properties": {
"temperature": {
"type": "number",
"examples": [20.5, 25.3, 18.7]
}
}
}Data example:
temperature
20.5
25.3
18.7missingValues [#column-missingvalues]
An optional column-level list of values that represent missing or null data for this column. Each item can be either a simple value or an object with value and label properties for documentation purposes. The missing values type MUST be:
"string"or"integer"for boolean, integer, and number columns"string"for all other columns
If table-level missing values are provided, the effective missing values MUST include all the column-level values and all the compatible table-level values.
Metadata example:
{
"properties": {
"measurement": {
"type": "number",
"missingValues": [
{ "value": -999, "label": "Sensor malfunction" },
{ "value": "NA", "label": "Not measured" }
]
}
}
}Data example:
measurement
25.3
-999
NA
42.1Column Types
Boolean
A column for true/false values. It MUST have type set to "boolean" and MUST NOT have a format property.
Metadata example:
{
"properties": {
"is_active": {
"type": "boolean"
}
}
}Data example:
is_active
true
false
trueType properties:
Categorical
A column for categorical values. It MUST have type set to "integer" or "string" and format set to "categorical".
A value is read as a value of its type: an integer categorical column reads its cells as an Integer column does, and a string categorical column matches a cell against its categories exactly, character for character, without trimming or case folding. The constraints below apply to every value in addition to categories, so a listed category that fails one, such as a category below minimum, is an error.
Metadata example:
{
"properties": {
"severity": {
"type": "integer",
"format": "categorical",
"categories": [
{ "value": 1, "label": "Low" },
{ "value": 2, "label": "Medium" },
{ "value": 3, "label": "High" }
]
}
}
}Data example:
severity
1
2
3
1Type properties:
In addition, type properties if type is "integer":
In addition, type properties if type is "string":
Integer
A column for whole number values. It MUST have type set to "integer" and MUST NOT have a format property.
A cell delivered as text MUST be a number in the grammar of a Number column whose fraction is zero, as an integer is in JSON Schema 2020-12: 1.0 and 1e3 are integers, 1.5 and 1e-1 are not.
An integer value MUST lie in the signed 64-bit range, from -9223372036854775808 to 9223372036854775807; a value outside it is a cell/type error. This is a deliberate deviation from JSON Schema, whose integers are unbounded, so that every implementation holds the same values exactly: a whole number that needs more digits belongs in a Decimal column. The range applies to every column of type "integer", including an integer Categorical one.
Metadata example:
{
"properties": {
"age": {
"type": "integer"
}
}
}Data example:
age
25
32
18Type properties:
Number
A column for numeric values including decimals. It MUST have type set to "number" and MUST NOT have a format property.
A cell delivered as text MUST be a JSON number, as RFC 8259 section 6 defines it, once these have been applied, in this order: withText strips the text around the number, every groupChar is removed, and decimalChar is read as .. The grammar is an optional minus sign and never a plus sign, an integer part without leading zeros (0 alone is allowed), an optional fraction of a . with digits on both sides, and an optional exponent of e or E, an optional sign and digits. A value MUST NOT contain whitespace, and NaN, Infinity and their variants are not numbers. So 0.5, -2 and 1E-3 are numbers, and +1, 007, .5, 5., 1 and 0x10 are not. -0 is a number equal to 0.
Metadata example:
{
"properties": {
"temperature": {
"type": "number"
}
}
}Data example:
temperature
23.5
-10.2
98.6Type properties:
Decimal
A column for decimal values. It MUST have type set to "string" and format set to "decimal".
Metadata example:
{
"properties": {
"price": {
"type": "string",
"format": "decimal"
}
}
}Data example:
price
19.99
5.50
123.45Type properties:
minLengthmaxLengthpatternminimummaximumexclusiveMinimumexclusiveMaximummultipleOfdecimalChargroupCharwithText
String
A column for text values. It MUST have type set to "string" and MUST NOT have a format property.
Metadata example:
{
"properties": {
"name": {
"type": "string"
}
}
}Data example:
name
Alice
Bob
CharlieType properties:
List
A column for delimited list values stored as strings. It MUST have type set to "string" and format set to "list".
A cell is split at every delimiter, literally: there is no quoting or escaping inside a cell, and items are not trimmed. So a,,b has three items, the second empty, a,b, has a trailing empty item, and a is an item with a leading space. An empty cell, such as a quoted "" in CSV, is an empty list. Each item is then read as an itemType value.
Since the column is of type "string", as in JSON Schema minLength, maxLength and pattern apply to the cell's whole text before it is split, and minItems and maxItems to the number of items. Missing values match the whole cell only, never an item: with "NA" a missing value, the cell NA is null and the cell a,NA is a list of two items.
Metadata example:
{
"properties": {
"tags": {
"type": "string",
"format": "list"
}
}
}Data example:
tags
"red,blue,green"
"small,compact"
"new,sale,featured"Type properties:
URL
A column for URLs with HTTP/HTTPS protocol. It MUST have type set to "string" and format set to "url".
A value MUST match the URI production of RFC 3986, so it has a scheme and is never a relative reference, and it MAY end in a # fragment. In addition: its scheme MUST be http or https, in any case (HTTPS://example.com is valid), its host MUST NOT be empty (http:///path is invalid), and it MUST consist of ASCII characters only, so a non-ASCII character is written percent-encoded.
Metadata example:
{
"properties": {
"homepage": {
"type": "string",
"format": "url"
}
}
}Data example:
homepage
https://example.com
https://example.org/page
https://domain.net/path/to/resourceType properties:
A column for email addresses. It MUST have type set to "string" and format set to "email".
A value MUST match the Mailbox production of RFC 5321: a local part, as a dot-string or a quoted string ("john doe"@example.com), then @ and a domain or an address literal (user@[192.0.2.1]). A domain of a single label, such as user@localhost, is valid. A value with a non-ASCII character is invalid, as RFC 5321 allows none.
Metadata example:
{
"properties": {
"contact_email": {
"type": "string",
"format": "email"
}
}
}Data example:
contact_email
alice@example.com
bob@company.org
charlie@domain.netType properties:
Date
A column for ISO 8601 calendar dates. It MUST have type set to "string" and format set to "date", as the JSON Schema date format. A date is not associated with any time zone.
Without temporalFormat, a value MUST be a calendar date YYYY-MM-DD with nothing before or after it. Its fields follow RFC 3339 as the default forms set out, so the year 0000 is valid.
Metadata example:
{
"properties": {
"birth_date": {
"type": "string",
"format": "date"
}
}
}Data example:
birth_date
2023-12-01
1990-06-15
2005-03-20Type properties:
Time
A column for times of day with a UTC offset, as the RFC 3339 full-time and the JSON Schema time format. It MUST have type set to "string" and format set to "time". For times of day without an offset, use LocalTime.
Without temporalFormat, a value MUST be HH:MM:SS, optionally followed by fractional seconds (. and one or more digits), and then by Z or a +HH:MM or -HH:MM offset, with nothing before or after it. A value without an offset is invalid. Its fields and offset follow RFC 3339 as the default forms set out, so a lowercase z is valid in place of Z.
A value denotes a time of day in UTC: an implementation MUST apply the offset, so 14:30:00+02:00 and 12:30:00Z are the same value.
Metadata example:
{
"properties": {
"start_time": {
"type": "string",
"format": "time"
}
}
}Data example:
start_time
14:30:00Z
09:45:30+02:00
18:00:00.5-05:00Type properties:
LocalTime
A column for times of day without a UTC offset. It MUST have type set to "string" and format set to "local-time". A local time is not associated with any time zone, including the reader's: an implementation MUST NOT convert it to UTC.
Without temporalFormat, a value MUST be HH:MM:SS, optionally followed by fractional seconds (. and one or more digits), with nothing before or after it. A value with an offset is invalid. Its fields follow RFC 3339 as the default forms set out.
Metadata example:
{
"properties": {
"opening_time": {
"type": "string",
"format": "local-time"
}
}
}Data example:
opening_time
09:00:00
13:30:00
17:45:30.25Type properties:
DateTime
A column for instants: a date with a time of day and a UTC offset, as the RFC 3339 date-time and the JSON Schema date-time format. It MUST have type set to "string" and format set to "date-time". For dates with times without an offset, use LocalDateTime.
Without temporalFormat, a value MUST be YYYY-MM-DDTHH:MM:SS, optionally followed by fractional seconds (. and one or more digits), and then by Z or a +HH:MM or -HH:MM offset, with nothing before or after it. A value without an offset is invalid. Its fields, separators and offset follow RFC 3339 as the default forms set out, so a lowercase t or z is valid in place of T or Z.
A value denotes an instant: an implementation MUST apply the offset, so 2024-03-20T18:00:00-05:00 and 2024-03-20T23:00:00Z are the same value.
Metadata example:
{
"properties": {
"created_at": {
"type": "string",
"format": "date-time"
}
}
}Data example:
created_at
2023-12-01T14:30:00Z
2024-01-15T09:45:30+00:00
2024-03-20T18:00:00-05:00Type properties:
LocalDateTime
A column for dates with times of day without a UTC offset. It MUST have type set to "string" and format set to "local-date-time". A local date-time is not associated with any time zone, including the reader's: an implementation MUST NOT convert it to an instant.
Without temporalFormat, a value MUST be YYYY-MM-DDTHH:MM:SS, optionally followed by fractional seconds (. and one or more digits), with nothing before or after it. A value with an offset is invalid. Its fields and separator follow RFC 3339 as the default forms set out, so a lowercase t is valid in place of T.
Metadata example:
{
"properties": {
"recorded_at": {
"type": "string",
"format": "local-date-time"
}
}
}Data example:
recorded_at
2023-12-01T14:30:00
2024-01-15T09:45:30.125
2024-03-20T18:00:00Type properties:
Duration
A column for ISO 8601 duration values. It MUST have type set to "string" and format set to "duration".
A value MUST match the duration production of RFC 3339 Appendix A, letters in any case. So weeks stand alone (P1W, never P1W2D), every number is a whole number (PT1.5S is invalid), a value has no sign (-P1D is invalid), and P or PT with no component is invalid.
Metadata example:
{
"properties": {
"elapsed_time": {
"type": "string",
"format": "duration"
}
}
}Data example:
elapsed_time
PT1H30M
P1DT12H
PT45M30SType properties:
WKT
A column for Well-Known Text (WKT) geometry data. It MUST have type set to "string" and format set to "wkt".
Metadata example:
{
"properties": {
"geometry": {
"type": "string",
"format": "wkt"
}
}
}Data example:
geometry
"POINT (30 10)"
"LINESTRING (30 10, 10 30, 40 40)"
"POLYGON ((30 10, 40 40, 20 40, 10 20, 30 10))"Type properties:
WKB
A column for Well-Known Binary (WKB) geometry data. It MUST have type set to "string" and format set to "wkb".
Metadata example:
{
"properties": {
"geometry": {
"type": "string",
"format": "wkb"
}
}
}Data example:
geometry
01010000000000000000003E400000000000002440
0102000000030000000000000000003E40000000000000244000000000000024400000000000003E4000000000000044400000000000004440
010300000001000000050000000000000000003E4000000000000024400000000000004440000000000000444000000000000034400000000000004440000000000000244000000000000034400000000000003E400000000000002440Type properties:
Hex
A column for hexadecimal encoded data. It MUST have type set to "string" and format set to "hex".
A value MUST be an even number of hexadecimal digits, 0–9 and a–f in any case, two per byte. It MUST NOT have a 0x prefix or any whitespace.
Metadata example:
{
"properties": {
"color": {
"type": "string",
"format": "hex"
}
}
}Data example:
color
FF5733
00BFFF
32CD32Type properties:
Base64
A column for Base64 encoded binary data. It MUST have type set to "string" and format set to "base64".
A value MUST be Base64 in the standard alphabet of RFC 4648 section 4, with the = padding that makes its length a multiple of four. The URL-safe alphabet (- and _), a value without its padding and a value with whitespace or line breaks are invalid.
Metadata example:
{
"properties": {
"thumbnail": {
"type": "string",
"format": "base64"
}
}
}Data example:
thumbnail
iVBORw0KGgoAAAANSUhEUgAAAAUA
R0lGODlhAQABAIAAAAAAAP///yH5
aGVsbG8gd29ybGQ=Type properties:
Array
A column for array/list values. It MUST have type set to "array" and MUST NOT have a format property.
Metadata example:
{
"properties": {
"coordinates": {
"type": "array"
}
}
}Data example:
coordinates
"[1.5, 2.3]"
"[10, 20, 30]"
"[-5.2, 8.9, 12.1]"Type properties:
Object
A column for object/dictionary values. It MUST have type set to "object" and MUST NOT have a format property.
Metadata example:
{
"properties": {
"metadata": {
"type": "object"
}
}
}Data example:
metadata
"{""author"": ""John"", ""version"": 1}"
"{""author"": ""Jane"", ""version"": 2}"
"{""author"": ""Bob"", ""version"": 1}"Type properties:
GeoJSON
A column for GeoJSON geometry objects. It MUST have type set to "object" and format set to "geojson".
Metadata example:
{
"properties": {
"location": {
"type": "object",
"format": "geojson"
}
}
}Data example:
location
"{""type"": ""Point"", ""coordinates"": [30, 10]}"
"{""type"": ""LineString"", ""coordinates"": [[30, 10], [10, 30], [40, 40]]}"
"{""type"": ""Polygon"", ""coordinates"": [[[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]]}"Type properties:
TopoJSON
A column for TopoJSON geometry objects. It MUST have type set to "object" and format set to "topojson".
Metadata example:
{
"properties": {
"topology": {
"type": "object",
"format": "topojson"
}
}
}Data example:
topology
"{""type"": ""Topology"", ""objects"": {""example"": {""type"": ""Point"", ""coordinates"": [0, 0]}}}"
"{""type"": ""Topology"", ""arcs"": [[[0, 0], [1, 1]]], ""objects"": {""line"": {""type"": ""LineString"", ""arcs"": [0]}}}"
"{""type"": ""Topology"", ""objects"": {""polygon"": {""type"": ""Polygon"", ""arcs"": [[0]]}}}"Type properties:
Unknown
A column for values of unknown type. It has no type. Any value is valid in it, including a missing one.
Metadata example:
{
"properties": {
"column": {
"title": "Column",
"description": "Column description"
}
}
}Data example:
column
a
1
falseType Properties
format
An optional format qualifier that specifies a more specific subtype of the base type. A format takes effect only when it is one listed above for the column's type; any other format, on any type, is an annotation, as in JSON Schema, and the column is the plain column of its type. A validator SHOULD warn about a format it does not recognise.
Metadata example:
{
"properties": {
"email": {
"type": "string",
"format": "email"
}
}
}Data example:
email
alice@example.com
bob@company.org
charlie@domain.nettrueValues
An optional array of string values that MUST be interpreted as true when parsing data. It MUST be an array of strings. It defaults to ["true", "True", "TRUE", "1"]; a declared list replaces the default rather than adding to it, so with ["yes"] the cell true is not a boolean.
A cell matches an item exactly, character for character, without trimming or case folding. A value MUST NOT be both in trueValues and in falseValues, counting the default of a list the column does not declare: a Table Schema with such a value is invalid.
Metadata example:
{
"properties": {
"is_active": {
"type": "boolean",
"trueValues": ["yes", "true", "1", "Y"]
}
}
}Data example:
is_active
yes
true
1
YfalseValues
An optional array of string values that MUST be interpreted as false when parsing data. It MUST be an array of strings. It defaults to ["false", "False", "FALSE", "0"]; a declared list replaces the default rather than adding to it. A cell matches an item exactly, as for trueValues, and a value MUST NOT be in both lists.
Metadata example:
{
"properties": {
"is_active": {
"type": "boolean",
"falseValues": ["no", "false", "0", "N"]
}
}
}Data example:
is_active
no
false
0
Nminimum
An optional minimum value constraint (inclusive). It MUST be an integer for an integer column or an integer Categorical one and a number for a number or decimal column; a decimal column's bound is a JSON number although its values are text, so a bound with more precision than a JSON number holds is not exact. It applies only to the supported types; on any other column, such as a temporal one, it MUST be ignored.
Metadata example:
{
"properties": {
"temperature": {
"type": "number",
"minimum": -273.15
}
}
}Data example:
temperature
-200.5
25.3
100.0maximum
An optional maximum value constraint (inclusive). It MUST be an integer for an integer column or an integer Categorical one and a number for a number or decimal column; a decimal column's bound is a JSON number although its values are text, so a bound with more precision than a JSON number holds is not exact. It applies only to the supported types; on any other column, such as a temporal one, it MUST be ignored.
Metadata example:
{
"properties": {
"temperature": {
"type": "number",
"maximum": 1000
}
}
}Data example:
temperature
25.5
100.0
999.9exclusiveMinimum
An optional minimum value constraint (exclusive). It MUST be an integer for an integer column or an integer Categorical one and a number for a number or decimal column; a decimal column's bound is a JSON number although its values are text, so a bound with more precision than a JSON number holds is not exact. It applies only to the supported types; on any other column, such as a temporal one, it MUST be ignored.
Metadata example:
{
"properties": {
"probability": {
"type": "number",
"exclusiveMinimum": 0
}
}
}Data example:
probability
0.1
0.5
0.999exclusiveMaximum
An optional maximum value constraint (exclusive). It MUST be an integer for an integer column or an integer Categorical one and a number for a number or decimal column; a decimal column's bound is a JSON number although its values are text, so a bound with more precision than a JSON number holds is not exact. It applies only to the supported types; on any other column, such as a temporal one, it MUST be ignored.
Metadata example:
{
"properties": {
"probability": {
"type": "number",
"exclusiveMaximum": 1
}
}
}Data example:
probability
0.001
0.5
0.999multipleOf
An optional constraint that values MUST be a multiple of this number. For integers, including an integer Categorical column, it MUST be a positive integer. For numbers and decimals, it MUST be a positive number.
The check MUST use exact decimal arithmetic on the value as written, not binary floating point: a value is a multiple when dividing it by multipleOf gives an integer, so 99.99 is a multiple of 0.01.
Metadata example:
{
"properties": {
"price": {
"type": "number",
"multipleOf": 0.01
}
}
}Data example:
price
10.00
25.50
99.99decimalChar
An optional single character used as the decimal separator in the data. It defaults to a dot (.).
Metadata example:
{
"properties": {
"price": {
"type": "number",
"decimalChar": ","
}
}
}Data example:
price
19,99
5,50
123,45groupChar
An optional single character used as the thousands separator in the data. It MUST be a string of length 1. Without it, a value has no group separator.
Metadata example:
{
"properties": {
"population": {
"type": "integer",
"groupChar": ","
}
}
}Data example:
population
1,234,567
890,123
45,678withText
An optional boolean indicating whether numeric values may include text around the number, such as a currency or a unit. When true, the text before the first digit and after the last digit MUST be stripped before parsing; a decimalChar directly before the first digit belongs to the number. If the stripped prefix contains a minus sign (-), the number MUST be read as negative. Text between the first and the last digit is not stripped, so a cell such as 12 USD 5 is not a number. No scaling is applied: 5% is 5.
Metadata example:
{
"properties": {
"price": {
"type": "number",
"withText": true
}
}
}Data example:
price
$19.99
€25.50
£12.34
-$5.00minLength
An optional minimum length constraint for string values. It MUST be a non-negative integer.
Metadata example:
{
"properties": {
"username": {
"type": "string",
"minLength": 3
}
}
}Data example:
username
alice
bob123
charliemaxLength
An optional maximum length constraint for string values. It MUST be a non-negative integer.
Metadata example:
{
"properties": {
"username": {
"type": "string",
"maxLength": 20
}
}
}Data example:
username
alice
bob
charliepattern
An optional regular expression pattern that values MUST match. It MUST be a valid regular expression in the ECMA-262 dialect, as in JSON Schema. An implementation that cannot compile a pattern, such as one using look-around its regex engine lacks, MUST report it as an error at the pattern rather than fail. As in JSON Schema, the pattern is not anchored: a value matches when the pattern matches any part of it, so a pattern meant for the whole value uses ^ and $.
Metadata example:
{
"properties": {
"product_code": {
"type": "string",
"pattern": "^[A-Z]{3}-[0-9]{4}$"
}
}
}Data example:
product_code
ABC-1234
XYZ-5678
DEF-9012categories
An optional array of categorical values with optional labels. Each item can be either a simple value or an object with value and label properties. The values MUST have the same type as the containing property i.e. "string" or "integer".
Metadata example:
{
"properties": {
"severity": {
"type": "integer",
"format": "categorical",
"categories": [
{ "value": 1, "label": "Low" },
{ "value": 2, "label": "Medium" },
{ "value": 3, "label": "High" }
]
}
}
}Data example:
severity
1
2
3
1withOrder
An optional boolean indicating that the categorical values in the column have natural order: the order of categories. Sorting by the column then follows that order, as Sorting sets out.
Metadata example:
{
"properties": {
"severity": {
"type": "integer",
"format": "categorical",
"withOrder": true,
"categories": [
{ "value": 1, "label": "Low" },
{ "value": 2, "label": "Medium" },
{ "value": 3, "label": "High" }
]
}
}
}Data example:
severity
1
2
3
1delimiter
An optional single character used to delimit items in a list column. It defaults to a comma (,).
Metadata example:
{
"properties": {
"tags": {
"type": "string",
"format": "list",
"delimiter": ";"
}
}
}Data example:
tags
red;green;blue
alpha;beta
gamma;delta;epsilonitemType
An optional type for items in a list column. It MUST be one of: string, integer, number, boolean, date, time, local-time, date-time, local-date-time.
Metadata example:
{
"properties": {
"measurements": {
"type": "string",
"format": "list",
"itemType": "number"
}
}
}Data example:
measurements
"1.5,2.3,4.7"
"10.2,15.8"
"3.14,2.71,1.41"minItems
An optional minimum number of items for the column. It MUST be a non-negative integer.
Metadata example:
{
"properties": {
"tags": {
"type": "string",
"format": "list",
"minItems": 1
}
}
}Data example:
tags
"red,blue,green"
"small,compact"
"new,sale,featured"maxItems
An optional maximum number of items for the column. It MUST be a non-negative integer.
Metadata example:
{
"properties": {
"tags": {
"type": "string",
"format": "list",
"maxItems": 3
}
}
}Data example:
tags
"red,blue,green"
"small,compact"
"new,sale,featured"temporalFormat
An optional string specifying the pattern values are written in. A pattern is literal text and the conversion specifications below; it MUST NOT contain any other % sequence. A value MUST match the whole pattern: a value with text before or after the part the pattern matches is invalid.
| Specification | Meaning | Written as |
|---|---|---|
%Y | Year | 2024 |
%y | Year within a century: 00–69 is 2000–2069, 70–99 is 1970–1999 | 24 |
%m | Month, 01–12 | 01 |
%b | Abbreviated English month name | Jan |
%B | Full English month name; reading also accepts %b names | January |
%d | Day of the month, 01–31 | 05 |
%j | Day of the year, 001–366 | 005 |
%H | Hour, 00–23 | 14 |
%I | Hour on a 12-hour clock, 01–12 | 02 |
%p | AM or PM | PM |
%M | Minute, 00–59 | 30 |
%S | Second, 00–59 | 00 |
%.f | Optional fractional seconds: . and one or more digits | .5 as .500, none when zero |
%z | UTC offset +HHMM or -HHMM; reading also accepts +HH:MM | +0200 |
%:z | UTC offset +HH:MM or -HH:MM; reading also accepts +HHMM | +02:00 |
%% | A literal % | % |
Reading a value, a numeric field matches with or without its leading zeros, so 1/5/2024 matches %m/%d/%Y, and month names and %p match regardless of case. Writing a value, an implementation MUST use the forms in the last column, with fractional seconds in 3, 6 or 9 digits.
Without a pattern, a value is in the default form its type states, which follows the grammar of RFC 3339 section 5.6 for Date, Time, LocalTime, DateTime and LocalDateTime alike:
- A date is
YYYY-MM-DD, with any year from0000to9999, and a day that exists in its month and year - An hour is
00–23, so24:00:00is invalid; a minute is00–59; a second is00–59, or60for a leap second. A leap second is valid only at23:59:60in UTC once the offset is applied (23:59:60Z,15:59:60-08:00), or at23:59:60as written in a type without an offset - A date and a time are separated by
Tort; a space or any other separator is invalid - An offset is
Zorz, or a sign, two digits of hours00–23, a colon and two digits of minutes00–59, so offsets lie from-23:59to+23:59;+0200,+02and+24:00are invalid
Writing a DateTime or Time value, an implementation MUST write it in UTC. Without a pattern, it MUST write the default form of the type, with fractional seconds only when they are not zero and with Z as the offset.
A pattern for DateTime or Time MUST contain one offset specification, %z or %:z. A pattern for LocalDateTime, Date or LocalTime MUST NOT contain one.
Metadata example:
{
"properties": {
"collection_date": {
"type": "string",
"format": "date",
"temporalFormat": "%m/%d/%Y"
}
}
}Data example:
collection_date
01/15/2024
03/22/2024
12/31/2023<jsonSchema>
For array and object column types, all properties from JSON Schema Draft 2020-12 are supported to define the structure and validation rules.
For example, with an array column:
{
"properties": {
"coordinates": {
"type": "array",
"items": {
"type": "number"
},
"minItems": 2,
"maxItems": 3
}
}
}Data example:
coordinates
"[1.5, 2.3]"
"[10.2, 15.8, 20.5]"
"[3.14, 2.71]"For example, with an object column:
{
"properties": {
"metadata": {
"type": "object",
"properties": {
"author": { "type": "string" },
"version": { "type": "integer" }
},
"required": ["author"]
}
}
}Data example:
metadata
"{""author"": ""Alice"", ""version"": 1}"
"{""author"": ""Bob"", ""version"": 2}"
"{""author"": ""Charlie""}"Validation
A Table Schema that is not valid is reported with metadata errors, and no table is checked against it.
A validator that reports the errors of a table MUST list them in this order:
- Column errors, such as a required column missing from the data, then the columns
additionalPropertiesdoes not allow, in the order of the data - Cell errors, column by column in the order of
properties, and within a column by row - Row errors:
primaryKeyerrors, thenuniqueKeyserrors
foreignKeys errors are dataset-level and follow these, as the Dataset specification sets out.
A cell that cannot be read as its column's type has a cell/type error and no other: its constraints are not checked. A cell that can be read is checked against every constraint of its column, and each one it fails is a separate error. A validator MUST report them in this keyword order:
enum,constminimum,maximum,exclusiveMinimum,exclusiveMaximum,multipleOfminLength,maxLength,patternminItems,maxItems- The JSON Schema keywords of an Array, Object, GeoJSON or TopoJSON column (
<jsonSchema>)
A cell matches a boolean or category value exactly, character for character, without trimming or case folding, as trueValues and Categorical set out.
Sorting
An implementation that sorts a table by a column, such as in a query, MUST place null values last, in ascending and in descending order alike. A Categorical column with withOrder set to true sorts by the position of each value in categories; every other column, including a Categorical one without withOrder, sorts by value.
JSON Schema
A Table Schema MAY use any JSON Schema 2020-12 keyword that describes a single column, with the restrictions this specification states, and any annotation keyword such as $comment or deprecated. These keywords MUST be rejected, at the top level and on a column, since they do not describe one typed column per property: allOf, anyOf, oneOf, not, if, then, else, $ref, $dynamicRef, $defs, patternProperties, propertyNames, dependentRequired, dependentSchemas, unevaluatedProperties, unevaluatedItems. Inside an Array or Object column, which holds JSON values, every JSON Schema keyword is allowed.
The keywords enum, const, default and examples of a column that allows missing values MAY include null.
Common
Common properties shared by multiple entities in the descriptor.
External Path
It MUST be a string representing an HTTP or HTTPS URL to a remote file.
For example:
{
"data": "https://example.com/datasets/measurements.csv"
}Extension
Properties not defined by this specification or by JSON Schema are allowed, as in JSON Schema, so that a descriptor written for a later version stays readable: an implementation MUST ignore them and MAY warn about them. Fairspec Table Schema has no extension mechanism: such properties carry no meaning.
Comparison
Created with ❤ and Livemark