# Comma-Separated Values (Simple)

Key: `container.array.comma_separated`

Simple list of comma-separated values (not JSON array, plain CSV). Example: "apple,banana,cherry"

Page: <https://meridian.online/docs/projects/finetype/types/container/array/comma_separated>

Samples: `apple,banana,cherry`, `1,2,3,4,5`, `red,green,blue`

## Background

### Origin

FineType defines container.array.comma\_separated itself, as a simple list of comma-separated values that is not a JSON array.[[1]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml) FineType's label definition gives apple,banana,cherry as its example value.[[1]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml) FineType's label definition decomposes the value with STRING\_SPLIT on a comma.[[1]](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml)

The Frictionless Table Schema defines a list type whose lexical form is a string of values separated by a delimiter, which is a comma by default.[[2]](https://datapackage.org/standard/table-schema/) Table Schema says its list type is directly modelled on the concept of SQL typed collections.[[2]](https://datapackage.org/standard/table-schema/)

The HTML Standard defines a set of comma-separated tokens as a string of zero or more tokens, each separated from the next by a single comma.[[3]](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html) The HTML Standard counts the string " a ,b,,d d " as four tokens, one of which is the empty string.[[3]](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html) The HTML Standard says leading and trailing whitespace around each comma-separated token does not count as part of the token.[[3]](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html)

### Use

RFC 4180 says that CSV fields containing commas should be enclosed in double quotes.[[4]](https://www.rfc-editor.org/rfc/rfc4180.txt) When a comma-separated list sits inside one field of a CSV file, read the file with a proper CSV parser first and split the field only afterwards. (Meridian's view) Before splitting, look for items that might themselves contain a comma, such as numbers written with thousands separators or names written surname first. (Meridian's view)

DuckDB's string\_split(string, separator) function splits a string along the separator.[[5]](https://duckdb.org/docs/current/sql/functions/text.html) DuckDB lists string\_to\_array as an alias for string\_split.[[5]](https://duckdb.org/docs/current/sql/functions/text.html) Frictionless Table Schema lets a list field declare an itemType, and the item type defaults to string when none is given.[[2]](https://datapackage.org/standard/table-schema/) Treat every item as text until you have split the list, then decide the element type from the items themselves. (Meridian's view) Trim whitespace from each item after splitting, and decide whether an empty item means a missing value or a mistake. (Meridian's view)

## Sources

1. [finetype/labels/definitions\_container.yaml at main · meridian-online/finetype · GitHub](https://github.com/meridian-online/finetype/blob/main/labels/definitions_container.yaml) — FineType
2. [Table Schema \| Data Package Standard](https://datapackage.org/standard/table-schema/) — standard
3. [HTML Standard](https://html.spec.whatwg.org/multipage/common-microsyntaxes.html) — standard
4. [Common Format and MIME Type for Comma-Separated Values (CSV) Files](https://www.rfc-editor.org/rfc/rfc4180.txt) — standard
5. [Text Functions – DuckDB](https://duckdb.org/docs/current/sql/functions/text.html) — documentation
