JSON to CSV Converter
Found this tool useful? Share it:
What this JSON to CSV converter does
It turns JSON into CSV, the flat rows-and-columns format that Excel, Google Sheets and most databases import. The usual input is an array of objects, such as an API response or a database export: each object becomes one row, and the columns are the keys that appear in the data. Conversion happens in your browser as you type.
How to convert JSON to CSV
- Paste your JSON into the input box, or use Upload to read a .json or .txt file.
- Pick a delimiter. Use a semicolon if your spreadsheet is set to a European locale, or a tab for tab-separated files.
- Turn Include header row off if you only want the data rows, and Flatten nested objects off if you want nested values kept as JSON text.
- Copy the CSV, or download it as converted.csv. The download starts with a UTF-8 byte order mark so Excel shows accented characters correctly.
Example
[
{ "name": "Ann", "age": 30, "address": { "city": "Hull" } },
{ "name": "Bob", "city": "Paris" }
]name,age,address.city,city Ann,30,Hull, Bob,,,Paris
The nested address.city value becomes its own column, and cells for keys a row does not have are left empty.
How each kind of JSON is converted
| JSON | CSV result |
|---|---|
| Array of objects | One row per object. Columns are all keys, in the order they first appear. |
| A single object | One row. |
| Array of arrays | Each inner array becomes a row exactly as given. No header row is added. |
| Array of plain values | One column named value. |
| Missing key or null | An empty cell. |
| true / false / numbers | Written as true, false or the number. |
| Nested object, flatten on | Dotted columns such as address.city. |
| Nested object, flatten off | The object is written as JSON text in a quoted cell. |
| Array inside an object | Written as JSON text in a quoted cell. Arrays are not split into extra rows or columns. |
Quoting and escaping
Cells are quoted following the common RFC 4180 convention. A cell that contains the delimiter, a double quote or a line break is wrapped in double quotes, and any double quote inside it is doubled. So say "hi" becomes "say ""hi""". Lines are separated with a plain line feed.
Limits and things to watch
- Records with different keys are fine, but a column that only some records have is empty for the others.
- Deeply nested data and arrays of objects do not fit a flat table. They are kept as JSON text rather than guessed at, so check those columns before importing.
- The output only reflects the JSON. A spreadsheet may still reinterpret CSV values on import: long numbers, leading zeros and dates are common victims. Import the file as text columns when that matters.
- Spreadsheets can treat a cell that starts with =, +, - or @ as a formula. If the JSON comes from an untrusted source, review such cells before opening the CSV in Excel.
- Invalid JSON is not converted. The output box shows the parser message with the line and column of the problem.
Privacy
Text you paste is converted in your browser and is not sent to our servers. If you use the Upload button, the file is sent to our server to be read and is not stored. See the Privacy Policy.
See also
- CSV to JSON Converter - the reverse direction, with options for headers, numbers and delimiters
- JSON Formatter & Validator - check and prettify the JSON before converting it