CSV to JSON Converter

The Complete CSV & JSON Conversion Guide

How CSV and JSON structurally differ, how conversion maps between them, CSV quoting rules, and when you'd reach for one format over the other.

Open Tool

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

Quoted fieldsA field is wrapped in double quotes whenever it contains a comma, a line break, or a double quote itself - otherwise it can be written unquoted.
Escaped double quotesA literal double quote inside a quoted field is written as two double quotes in a row ("") - a single unescaped quote would end the field early.
Commas inside quotesA comma inside a quoted field is treated as part of the value, not a column separator - e.g. "New York, NY" stays one field.
Newlines inside quotesA quoted field can contain a real line break and still be read as a single cell, rather than starting a new row.

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

Importing spreadsheet data into an APIConvert a CSV export from a spreadsheet into JSON so it can be posted directly to a REST API endpoint.
Exporting query resultsTurn a JSON array of database or API query results into CSV so it can be opened, filtered, and shared in a spreadsheet.
Config file conversionMove tabular configuration data between CSV and JSON when different tools in your pipeline expect different formats.
Data migration between toolsReshape exported data on the way from one system to another when the destination tool only accepts one of the two formats.

Frequently Asked Questions

Why doesn't CSV have one official standard the way JSON does?

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.

Why can't CSV represent nested data the way JSON can?

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.

What commonly goes wrong when opening a CSV file in Excel?

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.

How does CSV to JSON conversion decide the object's keys?

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.

What's a common reason to convert between CSV and JSON?

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.

Open Tool