Data Formats
CSV
CSV (Comma-Separated Values) is a plain-text table format where each line is a row and each field is separated by a delimiter, usually a comma.
Updated 12 Aug 2026
The simplest useful data format
A CSV file is a table written as text. The first line usually holds column headers, every following line holds one record, and fields are separated by a delimiter. There is no type system: 42, 2026-01-01 and true are all just strings until something interprets them.
That simplicity is why every spreadsheet, database and analytics tool can import CSV, and also why CSV files break so often. RFC 4180 describes the common conventions, but plenty of exporters ignore it.
Quoting rules that matter
- A field containing the delimiter, a quote or a line break must be wrapped in double quotes
- A double quote inside a quoted field is escaped by doubling it: ""
- Every row should have the same number of fields as the header
- Encoding should be UTF-8; a byte-order mark can confuse older parsers
Why exports go wrong
Regional delimiters
Locales that use a comma as a decimal separator often export semicolon-delimited files.
Unquoted commas
An address field written without quotes silently shifts every later column.
Lost leading zeros
Spreadsheets convert 00123 to 123 unless the column is imported as text.
Mixed line endings
Files edited on both Windows and Unix can end up with inconsistent row breaks.
CSV to JSON
Turn a spreadsheet export into clean, typed JSON in one step.
Characteristics
- Plain text, one record per line
- Delimiter is usually a comma, sometimes a semicolon or tab
- No data types — every field is text
- Flat structure only; nesting must be flattened into columns
Common uses
- Spreadsheet and database exports
- Bulk import into CRMs, ad platforms and analytics tools
- Data science workflows and quick ad-hoc analysis
- Simple interchange between systems that share no API
Advantages
- Universally supported by spreadsheets, databases and scripts
- Streams row by row, so files larger than memory are fine
- Compact for uniform tabular data
- Readable and diffable as plain text
Limitations
- No standard for types, dates or encoding
- Cannot represent nested or hierarchical data
- Delimiter and quoting inconsistencies break imports
- No schema, so column meaning depends on convention
Examples
id,name,city,notes
4821,Ada Lovelace,London,"Prefers email, not phone"
4822,Alan Turing,Wilmslow,Frequently asked questions
What is a CSV file used for?
Moving tabular data between spreadsheets, databases and applications that do not share a direct integration.
Is CSV the same as Excel?
No. CSV is plain text with no formulas, formatting or multiple sheets; XLSX is a compressed, structured workbook format.
Which delimiter should I use?
Comma for international interchange. Use semicolons or tabs only when the destination expects them.
How do I keep leading zeros?
Import the column explicitly as text, or convert the file to JSON where the value stays a string.
Can CSV hold nested data?
Not directly. Flatten nested keys into dotted column names, or use JSON instead.
Related terms
JSON
JSON is a lightweight text-based data format commonly used to exchange structured data between applications and APIs.
XML
XML (Extensible Markup Language) is a text format that describes data using nested, self-labelled tags, designed for documents and long-lived system-to-system messaging.
YAML
YAML is a whitespace-indented data format designed to be written and read by people, most often used for configuration files such as CI pipelines and Kubernetes manifests.
JSON Schema
JSON Schema is a declarative vocabulary, itself written in JSON, that describes the expected structure, types and constraints of a JSON document so it can be validated automatically.
API
An API (Application Programming Interface) is a defined contract that lets one piece of software request data or actions from another without knowing how it works internally.
SQL
SQL (Structured Query Language) is the standard language for defining, querying and modifying data held in relational databases.
Related tools
Related guides
CSV vs JSON: Choosing the Right Data Format
Compare CSV and JSON on structure, nesting, file size, streaming, typing and tooling, with clear guidance on which to use for exports, APIs and analytics pipelines.
How to Format JSON (Beautify, Indent and Minify)
Learn how JSON formatting works, see a before-and-after example, fix the errors that block beautifying, and format JSON online in your browser without uploading a file.
What Is JSON? A Plain-English Guide
JSON explained without jargon: what it is, how the syntax works, which data types it supports, where it is used and how it differs from JavaScript objects.
Common JSON Errors and How to Fix Them
Decode the JSON parse errors you actually hit: unexpected token, trailing comma, unterminated string, BOM issues and duplicate keys — with the fix for each.