CSV vs JSON - How They Differ
CSV (Comma-Separated Values) is a flat, tabular format: every record is one row, every column is a fixed field, and there's no way to represent a value that itself contains structure - it's exactly what a spreadsheet grid already looks like, which is why apps like Excel and Google Sheets read and write it natively.
JSON (JavaScript Object Notation) represents data as a tree of nested key-value pairs and arrays. A single JSON record can hold an object inside an object, or a list of objects inside a field, with no fixed shape required across records. That flexibility is why most web APIs speak JSON rather than CSV.
Converting between the two means bridging a flat grid and a nested tree - straightforward when the data is already simple and tabular, and lossy or approximate whenever the JSON side has real nesting.
How the Conversion Works
CSV → JSON: the first row of the CSV is treated as the header row. Each column name in that row becomes a key, and every row beneath it becomes one JSON object whose keys are those column names and whose values are that row's cells - the result is a JSON array of flat objects, one per data row.
JSON → CSV: the tool accepts either a JSON array of objects or a single JSON object (treated as a one-row array), and uses the union of every object's keys - in first-seen order - as the CSV header row. Plain string, number, and boolean values go straight into their cell. Because CSV has no way to represent nested structure, any value that is itself an object or array falls back to its JSON string representation, placed in that cell (quoted per CSV rules) rather than being flattened or silently dropped.
CSV Quoting Rules
These are the RFC 4180 conventions most spreadsheet apps and CSV libraries follow, and what this tool's parser implements on both the read and write side.
Common Use Cases
Frequently Asked Questions
CSV predates any formal specification - spreadsheet vendors each wrote their own comma-separated export format long before anyone standardized it. RFC 4180, published in 2005, documented the most common conventions after the fact, but plenty of real-world CSV files still vary in delimiter, quoting, and encoding, which is why CSV parsers can disagree on edge cases.
CSV is fundamentally two-dimensional - just rows and columns - with no syntax for a value that is itself a structured collection. JSON's object and array syntax allows arbitrary nesting depth, which is the core structural difference between the two formats and the reason conversion between them is lossy in one direction.
Excel guesses each column's data type when it opens a CSV, so values like a leading-zero ID ("007"), a long numeric string that gets flipped into scientific notation, or a date in an unexpected locale format can get silently reformatted. Converting through JSON avoids this because JSON preserves exactly the string value you give it.
The first row of the CSV is treated as the header row - each column name in that row becomes the key used for that column's values in every JSON object generated from the rows below it.
Importing a spreadsheet export into a REST API that only accepts JSON, or exporting a JSON API response as CSV so it can be opened and filtered in a spreadsheet, are the two most common reasons.