SimplyCalculated.org

CSV ↔ JSON Converter

Paste CSV on one side and get JSON on the other — or paste JSON and get CSV — with live, bidirectional conversion that never leaves your browser. Handles quoted fields, escaped quotes, embedded newlines, and CRLF line endings.

100% private: everything is processed in your browser's memory — nothing you enter is uploaded to a server, logged, or stored.

CSV ↔ JSON Converter

First row becomes the keys. Quoted fields, escaped quotes, embedded newlines, and CRLF line endings are all supported.

Type or paste on either side — the other side updates live. JSON values stay strings when going to CSV, and nested data is flattened.

What Are CSV and JSON?

CSV (comma-separated values) and JSON (JavaScript Object Notation) are the two most common plain-text data formats on the web, and they model data very differently. CSV is a table: rows of cells separated by commas, usually with a header row naming the columns. It is what spreadsheets export, what databases dump, and what your bank's transaction history arrives as. JSON is a tree: objects with named keys whose values can be strings, numbers, booleans, arrays, or nested objects. It is what APIs return, what configuration files use, and what modern pipelines exchange between services. Converting between them means mapping a flat grid onto a nested structure — or the reverse — and doing that by hand for anything larger than a toy example is slow and error-prone.

Why Convert Between Them?

  • Spreadsheet to API: product catalogs, user lists, and inventory exported from Excel or Google Sheets need to become JSON objects before they can be posted to an API or loaded into an application.
  • API responses to spreadsheets: JSON from a REST endpoint is often easier to review, sort, and share after flattening to CSV for a spreadsheet.
  • Database exports and imports: many databases and admin tools accept CSV for bulk imports, while the same data model lives in JSON elsewhere.
  • Data analysis: analysts who live in spreadsheets can consume JSON payloads by converting them to a tabular form first.
  • Testing and debugging: inspecting a JSON payload as a table, or preparing a CSV fixture for a test suite that consumes JSON, are daily chores for developers.

How CSV → JSON Works Here

The CSV side follows RFC 4180, the standard for comma-separated data. Fields wrapped in double quotes may contain commas and newlines; a doubled quote ("") inside a quoted field represents a literal quote; CRLF, CR, and LF line endings are all accepted; a UTF-8 BOM is stripped; and a trailing newline does not create a phantom empty row. The first row becomes the object keys, so name,age turns into keys named name and age. Every value is kept as a string — CSV has no types — and rows are handled leniently: a row with fewer cells omits the missing keys, extra cells are ignored, and rows that are entirely empty are dropped. The result is pretty-printed with two-space indentation, ready to paste into code or a file.

How JSON → CSV Works Here

The JSON side accepts an array of objects or a single object. Keys are collected in order of first appearance across all rows, so objects with different key sets still produce a sensible unified header. Numbers and booleans become their plain text form, null and missing keys become empty cells, and objects or arrays are flattened into compact JSON inside a single cell. Any cell containing a comma, quote, or newline is quoted with doubled-quote escaping, so the output is always valid CSV that Excel and other tools will read back correctly. Invalid JSON, an empty array, or a non-object element produces a clear error message instead of garbage.

Step-by-Step: One Table, Both Directions

Start with the CSV name,age then Ada,36 then Bob,41. Pasting it into the left box produces the JSON array [{"name": "Ada", "age": "36"}, {"name": "Bob", "age": "41"}] — two objects keyed by the header row, values still strings. Now paste that JSON into the right box and the left side returns to exactly the original CSV, because the round trip is lossless for simple string tables. Add a nested field and the behavior changes: an object like {"name": "Ada", "meta": {"team": "eng"}} becomes the CSV row name,meta then Ada,"{"team":"eng"}" — the nested part survives, but as a flattened JSON blob rather than a structured column.

Quoted fields are where the parser earns its keep. Paste the row name,note then "Ada","said ""hi""" and the note cell comes back as said "hi" — the doubled quotes inside the field are unescaped, while the quotes that wrapped the field are discarded. Add a newline inside a quoted field and it survives intact too, which is how multi-line addresses and free-form notes survive a spreadsheet export. These are exactly the cases where a naive split-on-comma converter produces broken JSON, and exactly why this tool implements the full RFC 4180 rule set.

Reference Table

Input Output
name,age
Ada,36
{"name":"Ada","age":"36"}
name,city
"Ada, Lovelace",London
{"name": "Ada, Lovelace", "city": "London"}
[{"a":1},{"b":2}] a,b
1,
,2
[{"n":{"k":[1,2]}}] n
"{"k":[1,2]}"

Paste any row into the tool to confirm — the third row shows how missing keys become empty cells, and the fourth shows nested JSON flattened with quotes escaped.

Common Pitfalls

  • Types are not preserved: "36" in CSV is a string; if the JSON needs a number, retype it after converting or convert from JSON.
  • Nested data flattens: JSON trees become JSON-blob cells in CSV — acceptable for interchange, wrong for deep analysis.
  • Duplicate headers collide: two columns with the same name mean the later value wins in the JSON object.
  • Non-comma delimiters: semicolon or tab exports must be converted to commas first.
  • Missing trailing newline: fine here (this parser handles it), but some tools emit an extra empty row; this one does not.
  • BOM corruption: Excel-exported files may carry a BOM; this tool strips it so header keys stay clean.

Troubleshooting

The JSON Side Shows an Error for Valid-Looking CSV

Check the delimiter first — a semicolon-separated file will fail or produce a single-column table. Also check for unclosed quotes: a field that opens with a quote but never closes swallows the rest of the file.

The CSV Side Shows an Error for Valid-Looking JSON

The converter needs an array of objects or a single object. Arrays of primitives, strings, numbers, and null values are rejected with a clear message — wrap the data in objects first.

Very Large Files

This converter is built for interactive use — pasted data, exports up to a few megabytes — and runs entirely in the browser, so extremely large files can slow the tab. For a 100,000-row export, consider converting in chunks or using a command-line tool instead; for everyday spreadsheet and API work, this page is instant.

My Headers Look Corrupted

Trim stray spaces around header names — a header of name produces a key with spaces. This tool trims header whitespace automatically, so check your source file for invisible characters if keys still look wrong.

Frequently Asked Questions

Does the conversion preserve data types?
Going CSV to JSON, every value comes out as a string — CSV has no type information, so "36" stays "36" and never becomes the number 36. Going JSON to CSV, primitives are converted to their plain text form (36 becomes 36, true becomes true), while objects and arrays are flattened into compact JSON inside the cell. If you need typed data, convert from JSON to CSV and accept strings on the way back, or retype the values in your spreadsheet.
What happens to nested JSON objects and arrays?
They are flattened into single CSV cells as compact JSON. A value like {"k":[1,2]} becomes a cell containing {"k":[1,2]}, quoted and escaped so the comma and quotes inside it survive. This keeps the CSV well-formed, at the cost of nested data no longer being separately addressable in spreadsheet form — a reasonable trade when the nested part is a small blob.
Can I use semicolons or tabs as the delimiter?
This tool reads and writes comma-separated values, the standard CSV format (RFC 4180). If your source file uses semicolons — common in European spreadsheet exports — the fields will not split correctly. Paste the data after a find-and-replace of semicolons to commas, or re-export the file with the comma delimiter. Tab-separated data has the same problem.
What if my header row has duplicate or empty column names?
Empty header names are skipped — a column with no name simply does not appear in the JSON objects. Duplicate names are not deduplicated, so the later one overwrites the earlier one in the output; rename duplicates in the source before converting if you need every column.
What is a BOM and why does it matter?
A BOM (byte order mark) is an invisible character some tools add to the start of a UTF-8 file, often Excel exports. Left in place, it becomes part of the first header name and silently corrupts every key. This tool strips a leading BOM automatically, so Excel-style exports convert cleanly.
Will converting back and forth reproduce my original data?
Approximately. CSV to JSON to CSV round-trips exactly for simple tables because the values are already strings. The reverse direction loses fidelity: JSON to CSV flattens nested values into JSON-blob cells, and CSV back to JSON would return those blobs as strings rather than objects. Types also degrade (numbers become strings). For a canonical data store keep the JSON; use CSV as an interchange format.
Is my data sent anywhere?
No. Both conversions run entirely in your browser — no network request, no server, no logging. Safe for confidential spreadsheets and unreleased API payloads.

Formula last verified August 22, 2026 against our published methodology .