JSON ⇄ CSV Converter

Developer

Convert between JSON and CSV, quoting and numbers handled properly.

CSV
name,city,salary,team Juan Cruz,"Cebu, Philippines",45000, Ana Reyes,Davao,52000,Payroll
2 rows · 4 columns
Rows2
Columns4
Not every record carries every field. The columns are the union of all of them and the gaps are left empty — taking the columns from the first record alone would silently drop a field that only some records have.

How to use

What it's for

Turn a list of records in JSON into a CSV that a spreadsheet can open, or a CSV back into JSON, without breaking addresses, names with commas or long numbers.

Before you start

Have the data to hand, copied from a file, an app or a spreadsheet. It is converted in your browser and nothing is sent anywhere.

  1. Choose the direction

    In Direction, pick JSON to CSV to make something a spreadsheet opens, or CSV to JSON to go the other way.

  2. Paste your data

    Replace the sample in the big box with your own. CSV is the plain-text form a spreadsheet saves: one row per line, with a character between the columns.

  3. Set the delimiter

    Delimiter is that character. Comma suits most .csv files; pick Semicolon or Tab if your file uses one of those.

  4. Decide about numbers (CSV to JSON only)

    Write numbers as numbers turns a value like 45000 into a number rather than text. Untick it to keep every value as text, exactly as written.

  5. Convert and copy

    Press Convert. The result is in the band at the top of the card — it also changes as you type — and Copy puts it on your clipboard.

  6. Check the round trip, if you like

    Swap and convert back feeds the result back in the other direction, so you can see nothing was lost.

Reading the result

  • CSV or JSON: the converted text. A field holding a comma, a quote or a line break comes out wrapped in quotes — that is correct CSV, not a mistake.
  • Rows (or Records) and Columns: how many of each the converted data has.
  • Notes under the box say what the page did, such as leaving a column blank for records that lack that field.

If it goes wrong

  • A message says the JSON is broken: it names the problem, such as single quotes instead of double ones. Fix that spot and the result comes back.
  • A note says some rows do not have the same number of fields as the header: check that Delimiter matches your file, and that any field holding that character is in quotes.
  • A note warns about fields starting with =, +, - or @: a spreadsheet runs those as formulas. The page leaves them as they are, so deal with them before sending the file on.

What this is

CSV is not "split on commas", and that is the whole job. A field may contain a comma, a newline or a quote — and RFC 4180 handles all three by quoting the field and doubling any quote inside it.

A converter that simply splits on commas corrupts exactly the data most worth converting — an address, a note, a name with a comma in it — and does it silently.

Numbers are re-emitted verbatim. JSON.parse turns every number into a float, so 1234567890123456789 comes back …800 and 1.0 becomes 1. A converter is asked to change the format, never the values.

And a field starting with = is a formula to a spreadsheet. It is reported, never altered.

Questions

Why does a field come out wrapped in quotes?

Because it contains a comma, a quote or a newline, and CSV handles all three by quoting the field. A converter that simply joins values with commas corrupts exactly the data most worth converting — an address, a note, a name with a comma in it — and does so silently. A quote inside a quoted field is written twice, which is the rule from RFC 4180.

Why did my very long number survive here when other tools round it?

Because this does not parse your JSON with JSON.parse, which turns every number into a floating-point value — 1234567890123456789 comes back as …800, and 1.0 comes back as 1. A converter is asked to change the format, never the values, so numbers are re-emitted exactly as they were written. It uses the same hand-written parser as the JSON Formatter for the same reason.

What happens to nested objects and arrays?

A nested object is flattened into parent.child columns, which is what a spreadsheet can hold. An array is written as JSON inside a single cell — its length varies from row to row, so spreading it across columns would make the column set as wide as the longest array in the file with most rows empty.

Why are my columns taken from more than the first record?

Because taking them from the first record alone silently drops any field that only some records carry — and the rows that did have it look perfectly fine afterwards, which is how the loss goes unnoticed. The columns are the union of every record’s keys, and gaps are left empty.

What is CSV injection and why does the page warn about it?

A cell beginning with =, +, - or @ is treated as a formula by Excel and Google Sheets, so a field reading =HYPERLINK(...) becomes a live link when somebody else opens the file. This page reports every such field rather than altering it: prefixing a quote would change your data, and this is a converter. Handle them before sending the file on.

Why did my phone number turn into a different number?

Because number inference dropped the leading zero — 0917 becomes 917. Values that look numeric are written as numbers by default, which is usually wanted and occasionally wrong. This page keeps a value with a leading zero as text, but if you want everything kept as text, switch the inference off.

What happens if my CSV header repeats a column name?

The last column of that name wins, because a JSON object cannot hold the same key twice. The page says so rather than letting the earlier column vanish quietly — rename the columns first if both matter.

The maths

When a field needs quoting
Cebuno
Cebu, Philippinesholds the delimiter
say "hi"quote is doubled
line one ⏎ line twoholds a newline

Because a quoted field may contain a newline, the row boundary is not knowable without tracking quote state.

CSV injection

A cell beginning with =, +, - or @ is executed by Excel and Sheets. The page reports it and does not alter it: prefixing a quote would change your data, and this is a converter.

Keep going

Important

Runs entirely in your browser; nothing is transmitted. Numbers are re-emitted exactly as written rather than passed through a float. Fields a spreadsheet would treat as a formula are reported, never altered — changing them would change your data. Nothing you type here is sent to our servers — the calculation runs entirely in your browser.