How to use the JSON ↔ CSV converter
- Pick JSON → CSV or CSV → JSON, then paste, press Open file, or drop a
.json,.jsonlor.csvfile onto the input box (a.csvfile opens as CSV → JSON, a.jsonor.jsonlfile as JSON → CSV). Press Example to just try it out. - The result updates as you type. Pick the options you need; the tool remembers them:
- JSON → CSV: the Delimiter (comma, semicolon or tab), Header row and BOM for Excel; under More: Escape formulas, Quote all values and the Line endings (CRLF or LF).
- CSV → JSON: the Delimiter (Auto finds it), Header row and Detect types; under More: Nested objects and the Output, one JSON array or JSON Lines.
- The CSV table under the boxes shows the CSV as rows and columns: the CSV you get (JSON → CSV) or the one you paste (CSV → JSON). Click a cell to select its value in the CSV, or a row number for the whole row. Rows with more or fewer values than the header are highlighted. It shows the first 500 rows and 100 columns; Copy and Download always have all of them.
- Copy or Download the result. Swap sends it back to convert the other way.
If something is off, the line under the input says what and where. Show me selects the spot.
Example: JSON to CSV
A small product list with a nested object (size), a list (tags), a comma, quotes and barcodes with leading zeros:
[
{
"sku": "TEA-001",
"name": "Green tea, 20 bags",
"price": 4.5,
"stock": 120,
"barcode": "0012345678905",
"size": { "weight_g": 40, "box": "small" },
"tags": ["tea", "organic"]
},
{
"sku": "MUG-002",
"name": "Mug \"Good morning\"",
"price": 9.99,
"stock": 0,
"barcode": "0012345678912",
"size": { "weight_g": 310, "box": "medium" },
"tags": []
}
]
becomes this CSV:
sku,name,price,stock,barcode,size.weight_g,size.box,tags
TEA-001,"Green tea, 20 bags",4.5,120,0012345678905,40,small,"[""tea"",""organic""]"
MUG-002,"Mug ""Good morning""",9.99,0,0012345678912,310,medium,[]
size became two columns, size.weight_g and size.box. The list stayed whole, as JSON text in its cell. Values
with a comma or a quote got quotes around them, and a quote inside is written twice. Convert this CSV back with the
default options and you get exactly the JSON you started with.
Example: CSV to JSON
id,name,address.city,address.zip,newsletter
1,"Lee, Sam",Providence,02903,false
2,Mia Chen,,04101,true
becomes:
[
{
"id": 1,
"name": "Lee, Sam",
"address": {
"city": "Providence",
"zip": "02903"
},
"newsletter": false
},
{
"id": 2,
"name": "Mia Chen",
"address": {
"city": null,
"zip": "04101"
},
"newsletter": true
}
]
The first row names the keys. address.city and address.zip built the address object, id and newsletter
became a number and true/false, the ZIP codes kept their leading zero and the empty city became null.
JSON Lines (NDJSON)
JSON Lines has one JSON value per line, the way log files and database exports (MongoDB, BigQuery) write records. Paste it on the JSON → CSV side as it is: each line becomes a row.
{"id": 1, "event": "signup", "user": {"name": "Ada", "plan": "free"}}
{"id": 2, "event": "upgrade", "user": {"name": "Ada", "plan": "pro"}, "amount": 9.99}
{"id": 3, "event": "signup", "user": {"name": "Sam", "plan": "free"}}
becomes this CSV, and the note under the input says “Read as JSON Lines: 3 records, one per line.”:
id,event,user.name,user.plan,amount
1,signup,Ada,free,
2,upgrade,Ada,pro,9.99
3,signup,Sam,free,
Blank lines are skipped, and Windows line breaks are fine. A line that isn't valid JSON is an error at that line, with
Show me. A normal JSON document is never read as JSON Lines, also when it's printed over many lines. The other
way, CSV → JSON with More → Output → JSON Lines writes one compact line per row (the empty amount cells
become null):
{"id":1,"event":"signup","user":{"name":"Ada","plan":"free"},"amount":null}
{"id":2,"event":"upgrade","user":{"name":"Ada","plan":"pro"},"amount":9.99}
{"id":3,"event":"signup","user":{"name":"Sam","plan":"free"},"amount":null}
How CSV values become JSON
CSV has no types: every value is text. With Detect types on (the default), a value becomes a number, true/false or null only when that can't change it. Turning it back into CSV then writes exactly the same text.
| In the CSV | In the JSON | Why |
|---|---|---|
42 | 42 | written the way JSON writes numbers |
-0.25 | -0.25 | the same |
true | true | exactly true or false |
| (empty) | null | nothing there |
["a","b"] | ["a","b"] | a list or object written as compact JSON |
007 | "007" | a number would lose the leading zeros (ZIP codes, phone numbers, barcodes) |
1.50 | "1.50" | a number would drop the last zero (prices, version numbers) |
1e5 | "1e5" | JSON writes this number as 100000 |
+1 | "+1" | JSON numbers have no + sign |
12345678901234567890 | "12345678901234567890" | above 9007199254740991, JavaScript's largest exact whole number |
TRUE | "TRUE" | only lowercase true and false |
null | "null" | an empty cell is null; the word stays a word |
[1, 2] | "[1, 2]" | not compact: the spaces would be lost |
Turn Detect types off to get every value as text (an empty cell is then "").
Nested objects and lists
- JSON → CSV: a nested object becomes columns named with dots:
{"size": {"box": "small"}}is the columnsize.box. Lists and empty objects stay in one cell as compact JSON (["tea","organic"],{}). The columns are every key of every object, in the order they first appear; a key an object doesn't have is an empty cell. - CSV → JSON: with Nested objects on, a header like
address.citybuilds{"address": {"city": …}}again. It only splits where every part starts with a letter,_or$, so headers likeNo.,U.S. Sales,v1.2orPrice (U.S.)stay one key. If a columnasits next toa.b,a.bstays one key (a note says so). - One object that holds the list: API responses often look like
{"users": [...], "total": 2}. That's one object, so it makes one row; the note under the input offers Use “users” to make one row per user instead.
Delimiters, quotes and line breaks
- JSON → CSV writes RFC 4180 CSV: values are quoted only when they hold the delimiter, a quote or a line break,
and a quote inside a value is written twice (
"Mug ""Good morning"""). Rows end with a Windows line break (CRLF), the way Excel and the RFC write them. - Quote all values (under More) puts quotes around every value, the header too:
"TEA-001","Green tea, 20 bags","4.5","120". Some importers expect that. The quotes only mark where a value starts and ends: CSV readers like Python'scsvmodule and this tool read the same values back, numbers included. - Line endings (under More): keep CRLF for Excel and Windows, or pick LF for tools on macOS and Linux that expect Unix line breaks, or for files you keep in git. A line break inside a quoted value is kept as it is.
- CSV → JSON reads quoted values with commas, quotes and line breaks inside, CRLF, LF or CR line breaks, a missing last line break and a byte-order mark at the start. Auto picks the delimiter (comma, semicolon, tab or pipe) that splits every row into the same number of values. Cells copied from Excel or Google Sheets are tab-separated, so you can paste them straight in.
Common errors and warnings
- A quote that is never closed.
1,"Fragile, handle with care(no closing") would swallow the rest of the file into one value:Hmm, something's off on line 2, column 3: this quote is never closed, so everything after it would be one value. Add the closing ", or write a quote inside a value as "" 🤔 - A row with more or fewer values than the header.
2,Lee, Sam,Providencehas an unquoted comma in the name:Line 3 has 4 values, but the header has 3 (and 1 more row differs). Missing values are left empty; extra ones get keys like “column_4”.Nothing is dropped; put quotes around values with a comma ("Lee, Sam"). - JSON with a mistake.
[{"name": "Ada", "age": 36,}]:Hmm, something's off on line 1, column 27: trailing comma before } 🤔The JSON Formatter can fix most mistakes like this one with one click. - A list that mixes kinds.
[{"sku": "TEA-001"}, "MUG-002"]:Item 2 is a piece of text, but the items before it are objects. Every item needs to be the same kind to make rows 🤔
FAQ
How are nested JSON objects turned into CSV columns?
Each nested key becomes its own column, named with dots: {"size": {"weight_g": 40}} is the column
size.weight_g. Lists stay in one cell as JSON text, because their length differs from row to row. Converting the
CSV back with Nested objects on rebuilds the same objects and lists.
Excel puts everything in one column. What's wrong?
In many European languages (German, French, Italian, Spanish…) Excel expects semicolons, because the comma is the
decimal mark there (4,50). Pick Semicolon as the delimiter and download again. The other way around, Auto
finds the semicolons; a price like 4,50 stays text, because JSON numbers use a point.
Why do ZIP codes, phone numbers and long IDs stay text?
As a number, 02134 would become 2134 and 12345678901234567890 would lose its last digits in JavaScript and many
other JSON readers (they keep whole numbers exactly only up to 9007199254740991). So values like these stay text, and
the table above lists every rule. When converting JSON to CSV, numbers are written exactly as they are in your JSON,
big ones too.
What does Escape formulas do?
A cell that starts with =, +, - or @ can run as a formula when the file is opened in Excel, LibreOffice or
Google Sheets; files built from data other people typed can carry harmful ones (this is called CSV injection). The
tool always names the cells it finds (-5 and other plain numbers are fine). Escape formulas puts a ' in front
of them so spreadsheets show them as text. It's off by default because it changes your data; turn it on before you
share a file.
Accents and emoji look wrong in Excel (é instead of é). How do I fix it?
The CSV is UTF-8, and Excel on Windows only reads a CSV as UTF-8 when the file starts with a byte-order mark. Turn on BOM for Excel and download again: it adds that mark (three invisible bytes) to the downloaded file only, never to what you copy.
My CSV comes from an old Excel or another program and isn't UTF-8. Can I open it?
Yes. Open or drop the file: if it isn't valid UTF-8 and doesn't start with a byte-order mark, it's read as
Windows-1252, the encoding Excel on Windows uses for “CSV (Comma delimited)” in Western Europe and the Americas, and a
note above the input says so. If letters still look wrong (³ instead of ł, say), pick the file's own encoding in
the Encoding list next to the note: Central European, Cyrillic, Greek, Turkish, Japanese, Chinese, Korean and
more. The file is read again from the bytes it was opened with. The JSON or CSV you get is always UTF-8. Text you
paste was already decoded by your browser, so this is only for files.
Can it convert JSON Lines (NDJSON)?
Yes, both ways. Paste or open JSON Lines on the JSON → CSV side and each line becomes a row (see the example above).
For CSV → JSON, choose More → Output → JSON Lines to get one compact JSON object per line, ready for tools
that load JSON Lines; the download is then a .jsonl file.
Why does a row get a warning?
Every row should have as many values as the header. A row with fewer gets empty values; a row with more keeps the
extra ones under keys like column_4, so nothing is lost. The usual cause is a value with a comma and no quotes
around it, a wrong delimiter, or a comma at the end of a line. Show me selects the first such row.
What happens to empty cells, null and missing keys?
JSON → CSV writes null, empty text and missing keys as empty cells. CSV → JSON turns an empty cell into null (with
Detect types on) or "" (off). Repeated header names get _2, _3, and a header without a name becomes
column_3 (its position), so no value overwrites another.
Is my data uploaded?
No. The conversion runs in your browser (big files in a background worker of the page), files you open are read by your browser too, and your input is never uploaded. See the privacy page.