CSV to JSON conversion turns a flat spreadsheet into a structured array of objects that code can read, and JSON to CSV does the reverse so spreadsheets and humans can read it. Those two moves are among the most common chores in data work, and almost every one of them trips over the same handful of edge cases: a comma inside a value, a quote inside a quote, a line break inside a cell. This csv json converter handles all of them, in both directions, entirely in your browser. The guide below explains what CSV and JSON actually are, when to convert csv to json and when to go the other way, the quoting rules that make CSV reliable, and the limits you hit when the data gets nested.
What is CSV?
CSV stands for comma-separated values. It is the oldest and most universal way to move tabular data between programs: a plain-text file where each line is a row and each value on that line is separated by a comma. The first line is usually a header row naming the columns. Open any CSV in a text editor and you can read it; open it in Excel or Google Sheets and it becomes a grid. That simplicity is why CSV has outlived almost every proprietary format — a thirty-year-old CSV still opens today.
The catch is that “simple” hides real complexity. What happens when a value itself contains a comma, like a company name “Smith, Jones & Co”? What about a product description that spans two lines, or a quotation mark inside a quotation? The answer is a quoting convention, and the fact that so many CSV files are written by hand or by naive scripts that ignore it is exactly why a robust csv parser matters. Splitting a line on every comma is the single most common CSV bug in the wild.
What is JSON?
JSON — JavaScript Object Notation — is the format code speaks. It represents data as objects (key/value pairs inside curly braces) and arrays (ordered lists inside square brackets), and it nests naturally: a value can itself be an object or an array to any depth. Where CSV is a flat grid, JSON is a tree. It is the default payload of virtually every web API, configuration file and NoSQL document, because it maps cleanly onto the data structures programming languages already use.
When you convert csv to json, the usual target is an array of objects: each spreadsheet row becomes one object, and each column header becomes a key in that object. A CSV with columns name,role,city and a row Ada,Engineer,London becomes { "name": "Ada", "role": "Engineer", "city": "London" }. That shape is what most APIs expect to receive and what most front-end code loops over, which is why it is the default output of this csv to json online tool.
When should you convert between CSV and JSON?
The direction you need depends on who, or what, is on the receiving end. You usually convert CSV to JSON when a human-friendly export has to become machine-friendly input, and you convert json to csv when a machine’s output has to become human-friendly. A few concrete situations:
- Seeding a database or API: a client sends a spreadsheet of products or contacts, and your import endpoint wants a JSON array. CSV to JSON bridges the gap.
- Mocking front-end data: you have a CSV of sample records and want to drop them straight into a JavaScript file or a fetch stub as JSON.
- Reporting on API data: an endpoint returns a JSON array and a non-technical colleague wants it in Excel. JSON to CSV produces a file that opens in one double-click.
- Config and fixtures: test fixtures are often maintained as CSV because they are easy to edit, then converted to JSON at build time.
- Moving between tools: analytics platforms, CRMs and SEO tools each prefer one format; converting lets them talk to each other without custom glue code.
In each case the conversion is a quick, mechanical step — but only if it respects the structure of the source. Get the delimiter or the quoting wrong and you corrupt the data silently, which is worse than an outright error.
CSV structure: headers, delimiters and quoting rules
A well-formed CSV has three things worth understanding before you convert it. The first is the header row. By convention the first line names the columns, and those names become the JSON keys. This tool treats the first row as headers by default, with a toggle to turn that off when your file is raw data with no header — in which case you get an array of arrays instead of an array of objects.
The second is the delimiter. “Comma-separated” is the name, but the comma is not universal, which is covered in its own section below. The third, and the one that breaks the most scripts, is quoting. The widely followed specification here is RFC 4180, and its rules are short enough to state in full:
- A field that contains the delimiter, a double-quote, or a line break must be wrapped in double-quotes.
- A double-quote inside a quoted field is escaped by doubling it: "" represents a single literal ".
- A line break inside a quoted field is part of the value, not the end of the row.
- Fields that contain none of those characters may be left unquoted.
This converter implements those rules on both sides. When parsing CSV it reads quoted fields correctly, un-escapes doubled quotes, and keeps embedded newlines intact. When writing CSV from JSON it adds quotes only where a field actually needs them and escapes any internal quotes, so the output opens cleanly in Excel, Google Sheets and any compliant parser.
JSON arrays of objects: the target shape
The natural JSON representation of a table is an array of objects, and it is worth being precise about why. Each object is self-describing: the keys travel with the values, so you never have to remember that “column three is the city” the way you do with a bare CSV row. That makes the data resilient to reordering and easy to consume — record.city always works regardless of column position.
When you turn the tool the other way and convert JSON to CSV, the first job is deciding the columns. This json to csv converter takes the union of all keys across every object in the array, in the order they first appear. That matters because real JSON is often ragged: one record has a phone field, the next does not. By building the header from the union, every key gets a column, and any object missing that key simply gets an empty cell there rather than a shifted, misaligned row. It is the behaviour you want for exports where records are not perfectly uniform.
Handling commas, quotes and newlines inside fields
This is the heart of why a real parser beats a one-line split. Consider a CSV cell that reads "Rear Admiral, USN". A script that splits on commas turns that one value into two columns and shifts every field after it — the data is now wrong, and nothing flagged it. A compliant parser sees the opening quote, reads everything up to the matching closing quote as a single field, and treats the internal comma as ordinary text.
The same logic covers the two other hard cases. An escaped quote like ""A ship in port is safe."" collapses to a single pair of literal quotes in the value. A newline inside a quoted field — common when a spreadsheet cell holds a multi-line note or address — stays part of that value instead of ending the row early. The csv to json converter here tracks quote state character by character, so all three cases survive the round trip. If you paste CSV with an opening quote that is never closed, it stops and tells you, rather than producing silently garbled output.
Delimiters: comma vs semicolon vs tab (TSV)
The “comma” in CSV is a default, not a law. Three delimiters dominate in practice, and choosing the right one is the most common reason a conversion “doesn’t work”:
- Comma (,): the standard, and what most English-locale tools export.
- Semicolon (;): the default in many European locales, where the comma is the decimal separator (“1,5” means one-and-a-half), so Excel uses semicolons to separate columns instead. If your file looks like one giant column after import, it is almost always a semicolon file read as comma.
- Tab (\t): tab-separated values, or TSV. Popular for data that contains lots of commas naturally, because tabs rarely appear inside values. Many database and analytics exports are TSV.
Set the delimiter picker to match your source before converting. The tool uses your choice for both parsing CSV and writing CSV, so a semicolon round-trip stays semicolon throughout. When in doubt, open the raw file in a plain text editor and look at what sits between the first two values — that character is your delimiter.
Nested JSON and the limits of a flat format
CSV is strictly two-dimensional: rows and columns, nothing deeper. JSON is a tree. That mismatch is the one genuine limit of any converter, and it is honest to be clear about it. When your JSON has a nested object — say each record contains an address that is itself an object with street and city — there is no single, lossless way to flatten it into columns automatically.
This tool takes the safe, predictable route: a nested object or array is written into its CSV cell as a compact JSON string rather than being dropped or guessed at. Nothing is lost, and you can expand it later. If you want true flattening — a separate address.city column — the usual practice is to flatten the JSON first, giving each leaf value its own dotted key, then convert. For nested data that you only need to read, validate or pretty-print rather than tabulate, reach for the JSON formatter instead; it is built for inspecting structure rather than flattening it.
Exporting CSV from Excel and Google Sheets
Most CSV files in the wild start life in a spreadsheet, and each app has its quirks worth knowing. In Google Sheets, use File → Download → Comma-separated values (.csv). Sheets reliably quotes fields that contain commas or newlines, so its exports are usually clean and import without fuss.
In Microsoft Excel, Save As → CSV UTF-8 is the option to prefer, because the plain “CSV” variant can mangle non-English characters and the UTF-8 variant preserves them. Watch for two classic Excel gremlins: it may use a semicolon delimiter depending on your regional settings, and it loves to “helpfully” reformat long numbers and dates — a phone number or an ID with leading zeros can lose them or turn into scientific notation. If a converted JSON value looks like 1.23E+11, that is Excel, not the converter. Format those columns as text before exporting, or keep the source data as JSON where the type is preserved.
CSV, JSON and data pipelines
In a data pipeline or integration, CSV and JSON tend to sit at opposite ends. CSV is the interchange and ingestion format: it is what partners email, what legacy systems emit, and what analysts drop into a bucket. JSON is the processing and transport format: it is what moves between services over HTTP, what queues carry, and what document stores keep. A huge amount of “glue” work is simply translating between the two at the boundaries.
For one-off and ad-hoc jobs — inspecting a file a colleague sent, preparing a small import, sanity-checking an API response — a browser converter like this is faster and safer than writing a throwaway script, and it will not silently mishandle the quoting the way a quick split(',') does. For recurring, high-volume pipelines you would script the same logic, but the rules it has to follow are exactly the ones described above: respect the delimiter, honour RFC 4180 quoting, build the header from the key union, and decide deliberately how to treat nested values.
How to use this converter
Pick a direction with the toggle — CSV to JSON is the default. Paste your data into the left box, choose the matching delimiter, and the converted result appears on the right instantly. For CSV to JSON, leave “First row is header” on to get an array of objects, or turn it off for an array of arrays. For JSON to CSV, paste an array of objects and the header row is built for you.
Use Copy to grab the output or Download to save it as a .json or .csv file. The swap button flips the direction and moves the output into the input, so you can convert CSV to JSON, eyeball it, then convert it straight back to confirm the round trip is clean. Everything runs in your browser — your data never leaves your device, which makes it safe for customer lists, internal exports and anything confidential. When you are done, explore the rest of the free tools, including the JSON formatter for validating and tidying the JSON you just produced.