JSON to CSV
Paste JSON or JSON Lines. Get CSV, with nested data flattened into columns. Nothing leaves your browser.
- 0
- Rows
- 0
- Columns
- 0
- Errors
On this page
About JSON to CSV Converter
Updated
JSON to CSV Converter turns JSON (JavaScript Object Notation) and JSON Lines into CSV (comma-separated values), the plain table that Excel, Google Sheets and databases open. Paste your JSON and the CSV shows as you type. Copy it, or download it as a .csv file.
The converter reads your JSON with a strict parser. When something is wrong, it rings the exact spot, gives the line and column, and says how to fix it. Every number stays as you wrote it, so 19.0 stays 19.0 and a 20-digit ID keeps every digit.
How to use it
- Paste JSON or JSON Lines, drop a file, or pick an example.
- Look at the CSV, or open Table to see it as rows and columns.
- Open Columns to leave out columns, or to pick the list the rows come from. Each column shows a sample value.
- Choose the delimiter in the Result header. Open Options for arrays, nested keys, the header row, null values, line ends and Excel.
- Press Copy or Download in the Result pane. Both take the CSV, in every view.
How JSON becomes a table
Each object is a row
An array of objects is the usual input. Each object becomes a row, and each key becomes a column. A key that only some objects have still gets a column; the other rows get an empty cell, and Notes says how many rows have it.
[
{ "id": 1, "name": "Ada", "role": "admin" },
{ "id": 2, "name": "Alan" }
]id,name,role
1,Ada,admin
2,Alan,Nested objects become columns
Keys inside a nested object are joined to the key around them with a dot: address.city. Under Nested keys in Options, you can join them with / or _ instead.
[
{ "id": 1, "address": { "city": "London", "zip": "W1" } }
]id,address.city,address.zip
1,London,W1Arrays, three ways
By default each array item gets a column with its position: tags.0, tags.1. Choose JSON text to keep the whole array in one cell, or One row per item to give each item in the array its own row. One row per item works on lists of objects and on lists of plain values, such as tags:
[
{ "order": "1001", "items": [ { "sku": "MUG", "qty": 2 }, { "sku": "TEE", "qty": 1 } ] }
]order,items.sku,items.qty
1001,MUG,2
1001,TEE,1API responses
Many APIs wrap the records in an object, such as { "page": 1, "data": [ ... ] }. The converter finds the biggest list of objects and makes the rows from it. Pick another list in the Columns view, or choose the whole object as one row. When you paste new JSON, the converter picks the list again.
JSON Lines
JSON Lines (also called JSONL or NDJSON) has one JSON value on each line. Logs and data exports often use it. Each line becomes a row:
{"level":"info","msg":"started","port":3000}
{"level":"warn","msg":"slow query","ms":912}level,msg,port,ms
info,started,3000,
warn,slow query,,912Text with commas, quotes and line breaks
When a value holds the delimiter, a double quote or a line break, the converter puts it in double quotes and doubles each double quote inside it, as RFC 4180 says. Every spreadsheet reads it back as one cell.
sku,title,note
A-1,"Chair, oak","He said ""sit"""A key used twice
When one object has the same key twice, the CSV keeps the last value, like most programs that read JSON. Notes shows where the key repeats.
Open the CSV in Excel or Google Sheets
Excel
- Turn on Excel in Options, then press Download. The file starts with a byte order mark, so Excel shows å, é and emoji right. Text that starts with = + - or @ gets a ' in front, so Excel does not run it as a formula.
- A double-click opens the file. To choose how each column reads, open Excel and go to Data > From Text/CSV instead.
- In that import, set a column to Text when it holds zip codes with a leading 0, IDs longer than 15 digits, or values such as
1-2. Otherwise Excel drops the 0, turns the last digits into zeros, or makes a date. Notes tells you which columns need this. - Where Excel uses a comma for decimals, choose Semicolon as the delimiter in the Result header.
Microsoft explains both steps in Opening CSV UTF-8 files correctly in Excel and Import or export text files.
Google Sheets
Download the CSV. In Google Sheets, go to File > Import, upload the file, and choose an import option. Leave the separator on Detect automatically, or pick the one you chose here. See Google's Import data sets and spreadsheets.
Common errors
A missing comma
Two values in a row need a comma between them. The converter rings the value that comes after the missing comma.
{ "id": 1, "name": "Ada" "role": "admin" }{ "id": 1, "name": "Ada", "role": "admin" }A comma before a closing bracket
JSON does not allow a comma after the last item. JavaScript does, so this error is common in JSON copied from code.
[
{ "id": 1 },
{ "id": 2 },
][
{ "id": 1 },
{ "id": 2 }
]Objects one after the other
Several objects with no list around them are neither JSON nor JSON Lines. Put each object on one line for JSON Lines, or put them in [ ] with commas between them.
{
"id": 1
}
{
"id": 2
}{"id": 1}
{"id": 2}Single quotes
JSON needs double quotes around keys and text. Single quotes come from Python or JavaScript objects.
[{ 'id': 1, 'name': 'Ada' }][{ "id": 1, "name": "Ada" }]Behind the scenes
Our own strict parser reads the JSON, the same one as in the JSON Validator. It keeps each number as written, so no digit is lost on the way to the CSV. The CSV follows RFC 4180. A background thread converts big files, so the page does not freeze. To go the other way, paste a CSV into the CSV Formatter and open its JSON view.
JSON and CSV resources
- RFC 4180The common format for CSV files: commas, double quotes and line breaks.
- JSON LinesThe format with one JSON value on each line, also called JSONL or NDJSON.
- Opening CSV UTF-8 files correctly in ExcelMicrosoft on the byte order mark, and how to import a UTF-8 CSV file without one.
- Import or export text (.txt or .csv) filesMicrosoft's steps for Data > From Text/CSV in Excel.
- Import data sets and spreadsheetsGoogle's steps to import a CSV file into Google Sheets.
- OWASP: CSV InjectionWhy a cell that starts with = + - or @ can run as a formula, and how to guard it.
- The JSON WebsiteThe official website for JSON, with the full syntax.
- RFC 8259The IETF standard that defines the JSON data format.
JSON to CSV FAQ
Can I convert JSON into CSV?
Yes, when the JSON holds a list of records, such as an array of objects or one object per line. Each object becomes a row and each key becomes a column. Nested objects become extra columns, such as address.city. A single object becomes one row.
How can I convert a JSON file to a CSV file online?
Drop the .json or .jsonl file on the editor, or paste its text. The CSV shows in the Result pane at once. Press Download in the Result pane to save it as a .csv file. Your browser reads the file, and nothing is uploaded.
How do I convert nested JSON to CSV?
The converter flattens nested data for you. Choose how arrays are written in Options:
- Columns (the default): each item gets its own column, such as tags.0 and tags.1.
- JSON text: the whole array goes into one cell, such as
["math","code"]. - One row per item: each item in an array gets its own row, and the fields around it repeat. Use this for orders with line items, or to put each tag on its own row.
How do I convert JSON Lines (JSONL or NDJSON) to CSV?
Paste the lines as they are. The converter sees that each line holds one JSON value and makes one row per line. When a line is broken, the converter rings it, gives its line number and lists the other broken lines too.
How do I open the CSV in Excel without broken characters?
Turn on Excel in Options before you press Download. The downloaded file then starts with a byte order mark, so Excel reads å, é and emoji correctly. Copy leaves the mark out, so pasted text stays clean. The option also puts a ' before text that starts with = + - or @, so Excel does not run it as a formula. In countries that use a comma for decimals, choose Semicolon as the delimiter.
How do I convert JSON to CSV in Notepad++?
Notepad++ has no JSON to CSV command of its own. The free JsonTools plugin adds a JSON to CSV form to its JSON tree viewer. Or paste the JSON here, and copy the CSV back into Notepad++. Nothing leaves your computer on the way.
Why use JSON instead of CSV?
JSON can hold nested data, lists and types: a number, true or null stays what it is. CSV holds one flat table of text, which every spreadsheet opens. Use JSON for APIs and configuration, and CSV when people need to sort, filter or share the data in a spreadsheet.
Is my JSON uploaded anywhere?
No. The conversion runs in your browser, even for big files. There are no ads, no sign-up and no cookie banner.