How to Convert a JSON File to CSV (and Vice‑Versa) Easily: Complete Guide with Examples
JSON and CSV are two formats that every developer, analyst, or system administrator encounters daily. The first is the language of modern APIs, the second is the language of spreadsheets like Excel or Google Sheets. Knowing how to switch from one to the other quickly, without losing information or mangling characters (accents, symbols), is a valuable skill.
In this guide, I'll show you step by step how to use the free JSON ↔ CSV converter from DevToolbox to transform your data in seconds, without ever sending a single byte to a remote server.
Why convert between JSON and CSV?
JSON (JavaScript Object Notation) is hierarchical, capable of representing arrays, nested objects, and various data types. CSV (Comma‑Separated Values) is flat, tabular, understood by all office tools. Here are three concrete situations:
- Exploit an API response in Excel: I receive a JSON, but my marketing colleague needs a table. Instead of writing a Python script, I convert directly.
- Feed a database: many ETL tools accept CSV as input. If my data is in JSON, I convert it before importing.
- Generate clean JSON for a frontend app: I retrieve a CRM export in CSV and transform it into structured JSON.
Both directions are genuinely useful, and a good converter should handle them with equal care.
Step 1: Access the tool and paste your data
Go to the JSON / CSV Converter page. The page works entirely in the browser: no data is sent to a server, which is crucial when handling sensitive information (clients, invoices, tokens).
The interface is split into two areas: JSON on the left and CSV on the right. You can either paste your text directly or drag & drop a file from your computer. The format detection is automatic: if you paste JSON, the conversion will go to CSV, and vice versa.
Step 2: Extract the array from a complex JSON (array path)
This is one of the features that makes this tool really useful compared to simpler alternatives. Imagine an API that returns a JSON like this:
{
"success": true,
"data": {
"users": [
{"id": 1, "name": "Alice", "age": 30},
{"id": 2, "name": "Bob", "age": 25}
]
}
}
The array you want is nested under data.users. Instead of copying only the useful part, simply enter data.users in the Array path field (located below the JSON area). The tool will automatically descend into the object and convert only the targeted array.
This technique saves considerable time when the API wraps data in several layers (success, data, response…).
Step 3: Flatten nested objects
JSON can contain sub‑objects inside each element of the array. Take this example:
[
{
"name": "Alice",
"address": {
"city": "Paris",
"zip": "75001"
}
}
]
If you convert as is, the address column will contain [object Object] — unusable in a spreadsheet. Check the "Flatten objects" box. Result:
| name | address.city | address.zip | | Alice | Paris | 75001 |
The tool transforms the hierarchy into flat columns with dot notation. You can then rename the columns in Excel if needed.
Step 4: Convert and visualize the table
Click the « Convert to CSV → » button. Immediately, a table preview appears at the bottom of the page. You see the first rows, column headers, and statistics: number of rows, columns, original JSON size and generated CSV size.
Before even downloading, you can verify that the conversion is correct. If a column looks odd (for instance, unexpected null values), you can go back and adjust the options.
Step 5: Download the CSV ready for Excel (UTF‑8 BOM)
Click « Download CSV (UTF-8 BOM) ». The UTF‑8 BOM is a small invisible marker placed at the beginning of the file. Without it, Excel may misinterpret accents or special characters, especially with non‑English versions. By using this option, you make sure your é, è, € will display correctly when opening, even by double‑clicking the file.
The downloaded file has the .csv extension and opens directly in Excel, Google Sheets, or any text editor.
Converting from CSV to JSON: advanced options
The reverse conversion is just as simple:
- Paste your CSV into the right‑hand area.
- Choose the delimiter: comma, semicolon, tab or pipe (
|). If you're unsure, leave the automatic detection on: the tool analyzes the first line and finds the most frequent character. - Indicate whether the first row contains headers (checked by default). If your CSV has no headers, the tool will automatically name the columns
col1,col2, etc. - Handle null values: in a CSV, an empty cell can mean "nothing", but in JSON you might want
null, an empty string"", or even the number0. Use the "Null values" dropdown to select the desired behavior. - Click « ← Convert to JSON ». The result is formatted with clean indentation, directly reusable in your code.
🔧 Try the JSON / CSV Converter
Pro tips for flawless conversions
- Pre‑format your JSON: use DevToolbox's JSON formatter to validate and indent your data before conversion.
- Watch out for numbers: non‑significant zeros (e.g. zip code
01234) can be interpreted as integers. Consider wrapping them in quotes in the CSV if needed. - Large volumes: everything is processed locally, but for JSON files of several tens of megabytes, prefer a command‑line script. The tool remains perfect for typical API exports (a few thousand lines).
- UTF‑8 BOM for Excel: always enable this option if the file is destined for an Excel user. It prevents strange "?" or garbled characters.
Frequently Asked Questions (FAQ)
Does the converter modify my original file?
No, everything happens in your browser. No data is sent to a server. Your file remains private.
Can I convert a deeply nested JSON (multiple levels of objects)?
Yes, the "Flatten objects" option handles as many levels as needed. Keys will be concatenated with a dot.
Which delimiter should I choose for a CSV that defaults to semicolon when opened?
In some locales, Excel uses the semicolon as the default separator. Specify ; in the dropdown before conversion, or generate a comma‑delimited CSV and then import it via Excel's "Data" tab.
Is the UTF‑8 BOM always necessary?
It is strongly recommended for Excel on Windows. Google Sheets and LibreOffice also handle it correctly, but it is not mandatory.