All formats
CSV vs JSON
CSV is flat rows and columns, readable by every spreadsheet and database on earth, and untyped: everything is a string. JSON carries nesting and real data types, which is why APIs use it. Tabular data goes to CSV. Anything with structure inside a field goes to JSON.
Side by side
| Spec | CSV | JSON |
|---|---|---|
| Type | Data | Data |
| Extensions | .csv | .json |
| Introduced | 1972 (RFC 4180 in 2005) | 2001 (ECMA-404 in 2013) |
| Compression | None | None |
| MIME type | text/csv | application/json |
| Use it when | Moving tabular data between systems, or handling files too large for a spreadsheet. | API payloads, configuration and any nested data structure. |
| Avoid it when | You need formulas, formatting, multiple sheets or guaranteed types. Use XLSX. | You need comments or anchors in config (use YAML), or flat tabular data (use CSV). |
Where the usual answer breaks
Very large datasets. CSV streams row by row; a JSON array usually has to be parsed whole unless you use JSON Lines.
CSV
- Readable by essentially every spreadsheet, database and language
- Plain text, so it diffs and streams well
- No practical size limit
- No data types, so leading zeros and long numbers get mangled
- No multi-sheet support, formulas or formatting
- Delimiter, quoting and encoding conventions differ between tools
JSON
- Native support in virtually every programming language
- Human-readable and simple to validate
- Handles nested and hierarchical data cleanly
- No comments, which makes it awkward for configuration files
- No date type, so dates are strings by convention
- Verbose compared with binary formats
Convert between CSV and JSON
JSON to CSV
CSV is flat and JSON is not. Nested objects and arrays have to be flattened into columns or dropped, which is the single thing that goes wrong most often here.
CSV to JSON
Every CSV value is text. Numbers, booleans and dates are inferred on the way in, which is convenient until a leading-zero ID like 0042 becomes the number 42.
Tools for these formats
Other comparisons
Last updated 2026-08-03