Skip to content

JSON to CSV & CSV to JSON Converter

Convert JSON to CSV and CSV to JSON in either direction, with RFC 4180 quoting, delimiter detection, nested-object flattening and type inference you control.

CSV

JSON

Paste CSV to convert it to an array of objects.

Conversion runs in your browser — the file is never uploaded, which matters when the export you are converting is a customer list. Anything lossy is reported above rather than applied quietly.

About the JSON to CSV & CSV to JSON Converter

Convert JSON to CSV and CSV to JSON in either direction, in the browser. The parser follows RFC 4180, which is the part most one-line conversions get wrong: a field wrapped in double quotes may contain the delimiter, a newline, or a doubled quote standing for a literal one. Splitting on commas handles none of that, and the damage is silent — the row count still looks plausible.

Going the other way, CSV has no types and no nesting, so a converter has to decide what to do with `null`, with a nested object and with an array. Here those decisions are visible: nested objects flatten to `parent.child` columns by default, arrays are written as JSON text because a spreadsheet cell cannot hold a list, and every row is checked against the union of keys across the whole document so a field present in only one record still gets a column.

Type inference is deliberately conservative. `42`, `true` and `null` become real JSON values; `007` and `01234` stay strings, because a leading zero means the value is an identifier — a zip code, a phone number, a part number — and turning it into a number destroys it. An integer too large for a double to hold exactly is kept as a string for the same reason. You can turn inference off entirely and keep everything as written.

  • RFC 4180 quoting: delimiters, newlines and doubled quotes inside quoted fields all survive
  • Delimiter detection that measures column consistency, not just how often a character appears
  • Type inference that refuses to destroy leading zeros or oversized integers
  • Nested objects flattened to dotted columns; arrays written as JSON
  • Ragged rows, duplicate headers and unterminated quotes reported rather than guessed at
  • Formula injection neutralised: a cell starting with =, + or @ is prefixed so a spreadsheet cannot run it

How to use it

  1. Choose a direction: CSV → JSON, or JSON → CSV.
  2. Paste your data on the left. For CSV, leave the delimiter on Auto unless the guess is wrong.
  3. Adjust the options — whether the first row is a header, whether to infer types, whether to flatten nested objects.
  4. Read the notes panel. Anything ambiguous or lossy about the conversion is listed there.
  5. Copy the result.

Real-world use cases

Backend developers

Turn a legacy CSV export handed over for a migration into JSON seed data, with ragged rows and duplicate headers called out instead of silently reshaped.

Data & analytics engineers

Convert a JSON array pulled from an API into CSV for a spreadsheet report, with nested fields flattened to columns rather than dumped as unreadable JSON text.

QA & test engineers

Turn a CSV test-data sheet from a product manager into JSON fixtures without writing a one-off script, and catch a mistyped leading zero before it becomes a wrong test.

Support & operations

Open a customer data export delivered as CSV and read it as structured JSON, without guessing which quoted field actually contains a comma.

Frontend developers

Sanity-check a CSV import or export feature's round trip — including formula-injection handling — before shipping it, using the same RFC 4180 rules a real spreadsheet expects.

Examples

A quoted field containing the delimiter

Input
name,city
"Lovelace, Ada",London
Output
[
  { "name": "Lovelace, Ada", "city": "London" }
]

The comma inside the quotes is data. This single case is why `line.split(",")` is not a CSV parser.

Type inference that does not destroy data

Input
id,zip,qty,active
7,01234,42,true
Output
[
  { "id": 7, "zip": "01234", "qty": 42, "active": true }
]

`01234` keeps its leading zero because no number can. This is the classic spreadsheet data loss, and it is the one thing a converter must not do quietly.

Nested JSON flattened into columns

Input
[{ "id": 1, "plan": { "tier": "pro", "seats": 3 } }]
Output
id,plan.tier,plan.seats
1,pro,3

Dotted column names round-trip back into nested objects in most tools. Turn Flatten off to get the nested object written as JSON text in a single cell instead.

Rows with different fields

Input
[{ "a": 1 }, { "b": 2 }]
Output
a,b
1,
,2

Columns are the union of every key seen, in first-seen order, so no field is dropped because it was absent from the first record.

Common errors

MessageCauseFix
The file ends inside a quoted fieldAn opening quote with no closing one — usually a truncated export, or a value that contained a quote character that was never escaped.Find the last `"` in the file. Inside a quoted field, a literal quote must be written twice.
Row has N fields, header has MA ragged row: an unescaped delimiter inside a value, or a genuinely short row.Missing fields are filled with empty strings and extra ones kept under `_extra`, so nothing is lost while you find the cause. The reported row number is the line in the file.
Duplicate column renamedTwo header cells have the same name, and JSON object keys must be unique.The second becomes `name_2`. Rename the columns in the source if the distinction matters.
Everything lands in one columnThe delimiter was detected wrongly — common with a semicolon-separated European export whose text fields contain commas.Set the delimiter explicitly instead of leaving it on Auto.
Excel shows the file as one long columnExcel follows the list separator from your regional settings, not the file.Use Data → From Text/CSV rather than double-clicking, or export with the semicolon delimiter. Turning on CRLF also helps older versions.
null became an empty cellCSV has no way to express null, so it is written as an empty field.Expected, and not reversible: reading that file back gives an empty string. If null must survive, JSON is the right format for the job.

Frequently asked questions

Is my file uploaded anywhere?

No. Parsing and conversion happen entirely in your browser. The CSV export you are converting is usually a customer list, an invoice run or an analytics dump — none of it leaves the page, and nothing is stored or logged.

Why did my leading zeros survive here when Excel eats them?

Because inference only converts what is unambiguously a number, and `01234` is not: JSON has no way to represent a number with a leading zero, so converting it would change the value. Zip codes, phone numbers, ISBNs and internal part codes all keep their exact text. The same rule applies to integers beyond 2^53, which a double cannot hold exactly.

How does the delimiter detection work?

It scores each candidate by how *consistent* a column count it produces across the first ten lines, not by how often the character appears. Counting occurrences picks the comma for a semicolon-delimited file whose text fields contain commas — which is exactly the file where getting it wrong matters most.

What happens to nested objects and arrays?

Nested objects become dotted columns — `plan.tier`, `plan.seats` — which most tools will nest again on the way back. Arrays are written as JSON text inside the cell, because CSV has no concept of a list; the conversion is reported in the notes panel rather than done silently.

What is CSV formula injection, and why does the output start with a quote?

A cell beginning with `=`, `+`, `-` or `@` is treated as a formula by Excel and Google Sheets, so a value like `=HYPERLINK(...)` from untrusted input becomes executable when someone opens the file. Prefixing a single quote is the standard mitigation and is on by default. Turn it off if you are generating a file that really does contain formulas.

Does it handle TSV and pipe-delimited files?

Yes — tab and pipe are both offered explicitly, and Auto detects them. The quoting rules are identical; only the separator changes.

Can I convert a single JSON object, not just an array?

Yes. A single object becomes a one-row CSV, and the notes panel says so explicitly rather than leaving you to notice. An array of objects is the common case, but the converter does not require one.

What happens if I convert an array of plain strings or numbers instead of objects?

There is no set of column names to derive from a scalar, so each value becomes a single-column table under the header `value`, and the notes panel flags that it did this. If some array items are objects and others are not, the non-object items land in that same `value` column while the rest use their real fields.

Last updated