CSV, JSON and YAML: three data formats and when each fits
Published June 13, 2026
CSV, JSON and YAML are the three text formats you meet most often when moving structured data around. They overlap enough that people sometimes treat them as interchangeable, then hit walls when a spreadsheet cannot express nesting or a config file becomes unreadable. Each was designed for a different job, and matching the format to the job saves a surprising amount of pain.
CSV: flat tables, nothing more
CSV — comma-separated values — is just rows of cells, exactly like a spreadsheet. It is compact, every tool can open it, and it is ideal for tabular data such as exports, reports and bulk imports. Its limit is that it is strictly two-dimensional: there is no clean way to nest a list inside a cell, and ambiguities around commas, quotes and line breaks inside fields cause real-world breakage if the file is not escaped carefully.
JSON: nested data for machines
JSON handles what CSV cannot: objects inside objects, lists inside lists, to any depth. It is the standard for APIs and web apps because it maps directly onto the data structures programs already use. The trade-off is verbosity — all those braces, brackets and quotes are easy for machines but tiring for humans to write by hand, and a single missing comma stops the whole file from loading.
YAML: config humans actually read
YAML stores the same nested data as JSON but uses indentation instead of braces, so it reads cleanly and is pleasant to edit. That is why it dominates configuration files for tools like Docker and CI pipelines. The catch is that its reliance on indentation makes it whitespace-sensitive: mix tabs and spaces, or misalign a line, and the meaning changes silently. YAML is a joy to read and a little risky to hand-edit at scale.
- Reach for CSV when the data is a simple table and a spreadsheet is the destination.
- Reach for JSON when programs exchange data or the structure is nested.
- Reach for YAML when a human edits the file often, like settings and configs.
Conversions between them are routine: flatten JSON to CSV for a spreadsheet, or lift a CSV into JSON for an API. Our CSV-to-JSON and JSON-to-YAML converters do this in your browser, and the JSON formatter validates the result as you go — so you can reshape data containing private fields without uploading it anywhere.