Technical previewShare feedback

Fairspec File Dialect

Updated Nov 17, 2026

Fairspec File Dialect is a simple JSON-based format that defines File Dialect to describe a file's format options and features. 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 File Dialect is a JSON resource that MUST be an object compatible with the File Dialect structure outlined below.

File Dialect

A top-level descriptor object describing a file dialect. It MUST have a format and MAY have the following properties (all optional unless otherwise stated):

$schema [#profile]

External Path to one of the officially published Fairspec File Dialect profiles with default value https://fairspec.org/profiles/latest/file-dialect.json.

For example for version X.Y.Z of the profile:

{
  "$schema": "https://fairspec.org/profiles/X.Y.Z/file-dialect.json",
  "format": "csv"
}

format [required] [#format]

The file format of the dialect. It is required and MUST be a string.

For example for a CSV file:

{
  "fileDialect": {
    "format": "csv"
  }
}

title

An optional human-readable title for the format.

For example:

{
  "fileDialect": {
    "format": "custom",
    "title": "My custom format"
  }
}

description

An optional detailed description of the format.

For example:

{
  "fileDialect": {
    "format": "custom",
    "title": "My custom format",
    "description": "You can open this file with OpenOffice"
  }
}

File Formats

A UTF-8 byte order mark at the start of a CSV, TSV, JSON or JSONL file is not part of its content: an implementation MUST ignore it.

CSV

A format for comma-separated values files. It MUST have format set to "csv". It MUST be utf-8 encoded. An unquoted empty cell (,,) is null, and a quoted empty cell (,"",) is an empty string.

A line with no characters at all is blank: it is not a row and takes no row number, wherever it is in the file. The terminator of the last line ends that row and starts no other, so a file ending in a terminator has no empty last row. A line holding only delimiters, such as ,,, is a row whose cells are all null.

A row with fewer cells than the table has columns is read with null in the cells it lacks. A row with more cells than the table has columns cannot be read: loading the file MUST fail, and validating it MUST report that the file cannot be loaded.

The names a header gives the columns MUST be unique; a header that repeats a name is an error. An empty name is a valid name, so two empty names are a repeated one.

Metadata example:

{
  "fileDialect": {
    "format": "csv"
  }
}

Data example:

name,age,city
Alice,30,New York
Bob,25,London
Charlie,35,Tokyo

Format properties:

TSV

A format for tab-separated values files. It MUST have format set to "tsv". It MUST be utf-8 encoded. An empty cell (two adjacent tabs) is null.

TSV has no quoting: a " is a literal character of its cell, and a cell cannot hold a tab or a line terminator. Blank lines, short and long rows and the names a header gives follow the rules of CSV.

Metadata example:

{
  "fileDialect": {
    "format": "tsv",
    "nullSequence": "\\N"
  }
}

Data example:

name	age	city
Alice	30	New York
Bob	25	London
Charlie	35	Tokyo

Format properties:

JSON

A format for JSON array files. It MUST have format set to "json". The rows are the items of the array at jsonPointer, or of the whole document without it. A JSON file whose top-level value is an object, read without a jsonPointer, is not a table.

Metadata example:

{
  "fileDialect": {
    "format": "json",
    "jsonPointer": "/data/items"
  }
}

Data example:

[
  { "name": "Alice", "age": 30, "city": "New York" },
  { "name": "Bob", "age": 25, "city": "London" },
  { "name": "Charlie", "age": 35, "city": "Tokyo" }
]

Format properties:

JSONL

A format for JSON Lines files (newline-delimited JSON). It MUST have format set to "jsonl".

As in CSV, a line with no characters at all is blank: it is not a row and takes no row number, and the terminator of the last line starts no other row. A line holding only JSON whitespace (spaces, tabs and carriage returns) is blank too: JSON allows whitespace around a value, and such a line holds none.

Metadata example:

{
  "fileDialect": {
    "format": "jsonl",
    "rowType": "object"
  }
}

Data example:

{"name": "Alice", "age": 30, "city": "New York"}
{"name": "Bob", "age": 25, "city": "London"}
{"name": "Charlie", "age": 35, "city": "Tokyo"}

Format properties:

XLSX

A format for Microsoft Excel files. It MUST have format set to "xlsx". Empty cells are null values. A merged range holds its value in its top-left cell only; its other cells are empty.

Metadata example:

{
  "fileDialect": {
    "format": "xlsx",
    "sheetNumber": 2
  }
}

Data example:

<binary data>

Format properties:

ODS

A format for OpenDocument Spreadsheet files. It MUST have format set to "ods". Empty cells are null values. A merged range holds its value in its top-left cell only; its other cells are empty.

Metadata example:

{
  "fileDialect": {
    "format": "ods",
    "sheetName": "Data Sheet"
  }
}

Data example:

<binary data>

Format properties:

Parquet

A format for Apache Parquet files. It MUST have format set to "parquet".

Metadata example:

{
  "fileDialect": {
    "format": "parquet"
  }
}

Data example:

<binary data>

Arrow

A format for Apache Arrow files. It MUST have format set to "arrow".

Metadata example:

{
  "fileDialect": {
    "format": "arrow"
  }
}

Data example:

<binary data>

SQLite

A format for SQLite database files. It MUST have format set to "sqlite".

Metadata example:

{
  "fileDialect": {
    "format": "sqlite"
  }
}

Data example:

<binary data>

Format properties:

Custom

A format for custom data. It MUST have format not supported by the formats above.

Metadata example:

{
  "fileDialect": {
    "format": "custom",
    "title": "Custom format",
    "description": "Custom format description"
  }
}

Data example:

<binary data>

Format Properties

A row is one parsed record of the file: in CSV and TSV, a quoted cell spanning several lines belongs to one row. Rows are numbered from 1, counting every row of the file before any is removed, so headerRows and commentRows refer to the same numbering. A blank line of CSV, TSV or JSONL is not a row and is not counted. A row MUST NOT be listed both in headerRows and in commentRows: a dialect that lists one in both is invalid.

A property the dialect leaves out takes its default, as stated for each property below; an implementation MUST NOT infer it from the data. Inference is only for a resource without a dialect (see Dataset), so a declared dialect reads the same in every implementation.

A file is never read with a dialect that is not valid: loading the file MUST fail, and validating it MUST report a metadata error at the dialect property that is not valid instead of checking the data.

delimiter

It MUST be a string of one character length. This property specifies the character sequence which separates fields in the data file. It defaults to a comma (,); TSV always separates fields with a tab.

For example:

{
  "fileDialect": {
    "format": "csv",
    "delimiter": ";"
  }
}

For a file like:

id;name;price
1;apple;1.50
2;orange;2.00

lineTerminator

It MUST be a string. This property specifies the character sequence which terminates rows in the file. Common values are \n (Unix), \r\n (Windows), \r (old Mac). It defaults to \n, and a \r directly before the terminator is not part of the row, so \r\n files read the same under the default.

For example:

{
  "fileDialect": {
    "format": "csv",
    "lineTerminator": "\r\n"
  }
}

quoteChar

It MUST be a string of one character length. This property specifies a character to use for quoting in case the delimiter needs to be used inside a data cell. It defaults to a double quote (").

For example:

{
  "fileDialect": {
    "format": "csv",
    "quoteChar": "'"
  }
}

For a file like:

id,name
1,'apple,red'
2,'orange,citrus'

nullSequence

It MUST be a string. This property specifies the null sequence representing missing values in the data. An unquoted cell equal to the sequence is read as null, in addition to the empty cells the format reads as null. A quoted cell is a string even when its text equals the sequence, as a quoted empty cell is.

For example:

{
  "fileDialect": {
    "format": "csv",
    "nullSequence": "\\N"
  }
}

For a file like:

id,name,notes
1,apple,fresh
2,orange,\N
3,banana,\N

headerRows

It MUST be false or an array of positive integers starting from 1. This property specifies the row numbers for the header. It defaults to [1], the first row; false means the file has no header, and so does an empty array [].

The listed rows form the header, joined top to bottom, so the array MUST list them in ascending order: a dialect with headerRows such as [3, 1] is invalid. Every row up to the last header row is consumed by the header and is never data: a row between two header rows that the list leaves out is dropped. With [1, 3], rows 1 and 3 form the header, row 2 is dropped and the data starts at row 4. A header row past the end of the file is an error.

For example with a single header row:

{
  "fileDialect": {
    "format": "csv",
    "headerRows": [1]
  }
}

For example with multi-line headers:

{
  "fileDialect": {
    "format": "csv",
    "headerRows": [1, 2]
  }
}

For a file like:

fruit
id,name,price
1,apple,1.50
2,orange,2.00

This would produce headers: "fruit id", "fruit name", "fruit price"

With several header rows, a label carries forward to the empty cells to its right in the same header row; the labels of each column are then joined across the header rows with headerJoin. A cell still empty after that, such as an empty first cell, adds nothing to the join: its column's name joins only the labels that are not empty.

For example with no headers:

{
  "fileDialect": {
    "format": "csv",
    "headerRows": false
  }
}

headerJoin

It MUST be a string. This property specifies how multiline-header files have to join the resulting header rows. It defaults to a single space (" ").

For example:

{
  "fileDialect": {
    "format": "csv",
    "headerRows": [1, 2],
    "headerJoin": "_"
  }
}

For a file like:

fruit
id,name,price
1,apple,1.50

This would produce headers: "fruit_id", "fruit_name", "fruit_price"

commentRows

It MUST be an array of positive integers starting from 1. This property specifies what rows have to be omitted from the data. In JSON and JSONL with rowType object, rows have no fixed order of cells to comment, so commentRows does not apply.

For example:

{
  "fileDialect": {
    "format": "csv",
    "commentRows": [1, 5, 10]
  }
}

For a file like:

id,name
# This is a comment row
1,apple
2,orange

With "commentRows": [2], the second row would be skipped.

commentPrefix

It MUST be a string. This property specifies what rows have to be omitted from the data based on the row's prefix.

For example:

{
  "fileDialect": {
    "format": "csv",
    "commentPrefix": "#"
  }
}

For a file like:

id,name
# This row is ignored
1,apple
# Another comment
2,orange

Rows starting with # will be skipped.

columnNames

It MUST be an array of strings. This property specifies explicit column names to use instead of deriving them from the file.

With rows of cells, the n-th name is the name of the n-th column. Fewer names than the file has columns is an error; more names than the file has columns add columns that are null in every row. With rowType object, the names select the keys to read and give their order.

For example:

{
  "fileDialect": {
    "format": "csv",
    "headerRows": false,
    "columnNames": ["id", "name", "price"]
  }
}

For a file without headers:

1,apple,1.50
2,orange,2.00

jsonPointer

It MUST be a string in JSON Pointer format (RFC 6901). This property specifies where a data is located in the document. The empty string "" points to the whole document, and a key containing ~ or / is written with ~0 or ~1 in their place.

For example:

{
  "fileDialect": {
    "format": "json",
    "jsonPointer": "/data/items"
  }
}

For a JSON file like:

{
  "metadata": { "version": "1.0" },
  "data": {
    "items": [
      { "id": 1, "name": "apple" },
      { "id": 2, "name": "orange" }
    ]
  }
}

rowType

It MUST be one of the following values: array, object. This property specifies whether the data items are arrays or objects. Without it, the first item decides: an array means array, anything else object.

With array rows, a row with more items than the table has columns cannot be read, as a long row of CSV: loading the file MUST fail, and validating it MUST report that the file cannot be loaded. It is never truncated to the header.

With object rows, the columns are the union of the rows' keys, in the order each key is first seen, and a row without a key is null in its column. columnNames, when present, selects and orders the columns instead.

For example with array of objects:

{
  "fileDialect": {
    "format": "json",
    "rowType": "object"
  }
}

For data like:

[
  { "id": 1, "name": "apple" },
  { "id": 2, "name": "orange" }
]

For example with array of arrays:

{
  "fileDialect": {
    "format": "json",
    "rowType": "array",
    "columnNames": ["id", "name"]
  }
}

For data like:

[
  [1, "apple"],
  [2, "orange"]
]

sheetNumber

It MUST be a positive integer, counting sheets from 1. This property specifies a sheet number of a table in the spreadsheet file. If not provided, a first sheet is used. Sheets are counted in the order of the workbook, hidden sheets included, so the first sheet is the first of the workbook whether or not it is hidden.

For example:

{
  "fileDialect": {
    "format": "xlsx",
    "sheetNumber": 2
  }
}

This reads the second sheet from the spreadsheet.

sheetName

It MUST be a string. This property specifies a sheet name of a table in the spreadsheet file. A dialect MUST NOT set both sheetName and sheetNumber.

For example:

{
  "fileDialect": {
    "format": "xlsx",
    "sheetName": "Data Sheet"
  }
}

tableName

It MUST be a string. This property specifies a name of the table in the database. If not provided, a first table is used (sorted by name in ascending order).

For example:

{
  "fileDialect": {
    "format": "sqlite",
    "tableName": "measurements"
  }
}

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 are allowed, so that a descriptor written for a later version stays readable: an implementation MUST ignore them and MAY warn about them. Fairspec File Dialect has no extension mechanism: such properties carry no meaning.

Comparison

Created with โค and Livemark