JSON to CSV Converter
runs in your browserTurn JSON into CSV or CSV into JSON, with nested values flattened into columns, quoted fields handled properly and a preview of the table.
JSON
CSV
about this tool
Both directions
JSON to CSV for getting API data into a spreadsheet, and CSV to JSON for getting a spreadsheet export into an application. Swap the direction with one control.
From JSON to a table
The input should be an array of objects — the shape almost every API returns for a list. Each object becomes a row.
Columns are the union of every key across every row, not just the keys in
the first object, which matters because real data is ragged: if row 1 has no
middle_name and row 40 does, that column still appears, with an empty cell
where the value is missing. Tools that read only the first record silently drop
those fields.
Flatten turns nested objects into dotted column names, so
{"address": {"city": "London"}} becomes a column called address.city. Without
it, a nested object has to be rendered into a single cell as JSON, which a
spreadsheet cannot sort or filter.
Delimiters
Comma, semicolon, tab or pipe. Semicolon is worth knowing about: in locales where the comma is the decimal separator, Excel writes and expects semicolon-separated files, which is why a perfectly valid comma-separated file sometimes opens in a single column on a colleague's machine.
Tab-separated output is the most reliable thing to paste directly into a spreadsheet or a Google Sheet.
Quoting, and the escaping rules
Values containing the delimiter, a double quote or a line break are wrapped in
quotes, and embedded quotes are doubled — say "hi" becomes "say ""hi""".
That is the CSV convention as specified in RFC 4180, and getting it wrong is the
usual reason a file imports with rows split in the wrong places.
From CSV back to JSON
The first row is treated as the header and becomes the object keys. Be aware
that CSV has no types: every value arrives as text, so "42" is a string until
something converts it. That is a property of the format, not of this tool, and
it is why a CSV round trip is not lossless — a number that went out as 42
comes back as "42", and a leading zero on a postcode or a phone number
survives here but will be destroyed by a spreadsheet that reads it as a number.
To look at a CSV or a spreadsheet without converting it at all, the CSV & Excel viewer opens the file directly. Records that arrive one per line, as NDJSON or JSON Lines, can be gathered into a JSON array first with the NDJSON converter.
Nothing is uploaded
Both conversions happen in the page, which matters because CSV exports are usually the most personal data an organisation moves around — customer lists, payroll, orders.
questions
- What shape does my JSON need to be?
- An array of objects, which is what nearly every API returns for a list. Each object becomes one row and the columns are drawn from the keys.
- Will it lose fields that only appear in some records?
- No. Columns are the union of every key across every row, so a field present in row 40 but not row 1 still gets a column with empty cells elsewhere. Tools that read only the first record silently drop those fields.
- How are nested objects handled?
- Turn on flatten and they become dotted column names, so an address object yields an address.city column. Without flattening a nested object has to go into one cell as JSON, which a spreadsheet cannot sort or filter.
- Why does my CSV open in a single column in Excel?
- Because in locales where the comma is the decimal separator, Excel expects semicolon-separated files. Switch the delimiter to semicolon, or use tab-separated output, which pastes into a spreadsheet most reliably.
- Is a JSON to CSV to JSON round trip lossless?
- No, and that is a property of CSV rather than of this tool. CSV has no types, so every value returns as a string: a number sent as 42 comes back as "42". Leading zeros survive here but a spreadsheet will destroy them.