JSON ↔ CSV Converter
Convert JSON arrays to CSV and CSV back to JSON — with nested object flattening, custom delimiters, and table preview. Nothing leaves your browser.
| name | age | city | active |
|---|---|---|---|
| Alice | 30 | New York | true |
| Bob | 25 | London | false |
| Carol | 35 | Tokyo | true |
What Is JSON and When Should You Use It?
JSON (JavaScript Object Notation) is a lightweight, text-based data interchange format. It represents data as human-readable key-value pairs, arrays, and nested structures:
[
{ "name": "Alice", "age": 30, "city": "New York" },
{ "name": "Bob", "age": 25, "city": "London" }
]
JSON is the de-facto standard for REST APIs, configuration files, and NoSQL databases. It excels at representing hierarchical, schema-flexible data — objects within objects, optional fields, mixed types — things that are awkward to express in tabular form.
Use JSON when:
- Exchanging data between a frontend and a backend API
- Storing configuration (package.json, tsconfig.json, settings files)
- Working with NoSQL databases (MongoDB, Firebase, DynamoDB)
- Data has a nested or irregular structure
What Is CSV and When Should You Use It?
CSV (Comma-Separated Values) is the simplest possible tabular format: each line is a row, fields are separated by a delimiter (comma by default), and the first row is usually a header:
name,age,city
Alice,30,New York
Bob,25,London
CSV is universally supported — every spreadsheet application (Excel, Google Sheets, LibreOffice Calc), most databases, and virtually every data-processing tool can read and write CSV without any special library.
Use CSV when:
- Importing or exporting data to/from Excel or Google Sheets
- Feeding data to business-intelligence tools (Tableau, Power BI, Looker)
- Bulk-uploading records to a CRM or e-commerce platform
- Sharing tabular data with non-technical stakeholders
- Processing large datasets with command-line tools (
awk,cut,csvkit)
How JSON ↔ CSV Conversion Works
JSON Array to CSV
To convert JSON to CSV, the tool treats each object in the array as one row. Object keys become column headers:
| JSON field | CSV column |
|---|---|
"name": "Alice" | name column, value Alice |
"age": 30 | age column, value 30 |
"active": true | active column, value true |
Nested objects are flattened using dot notation by default. A JSON field {"address": {"city": "NYC"}} becomes a CSV column named address.city with value NYC. Nested arrays are serialized as JSON strings.
Missing fields across rows are filled with empty strings — if one object has a field that others lack, that column still appears with an empty cell.
Special characters in field values (commas, quotes, newlines) are automatically quoted per RFC 4180.
CSV to JSON
The reverse process reads each CSV row into a JSON object:
- The first row becomes the object keys (property names)
- Each subsequent row becomes a JSON object
- Values are type-coerced automatically:
"true"/"false"→ booleantrue/false"42"/"3.14"→ number42/3.14""or"null"→null- Everything else → string
Supported Delimiters
| Delimiter | Symbol | Common uses |
|---|---|---|
| Comma | , | Standard CSV, most tools |
| Tab | \t | TSV files, Excel copy-paste |
| Semicolon | ; | European locales (where , is the decimal separator) |
| Pipe | | | Log files, database exports |
In CSV → JSON mode the delimiter is auto-detected from the first line of your input. You can override it manually if the detection is wrong.
Handling Edge Cases
Quoted Fields
Fields containing the delimiter character, double-quotes, or newlines are automatically wrapped in double quotes per RFC 4180:
"New York, NY",Alice,30
"She said ""hello""",Bob,25
The parser handles:
- Fields with embedded commas:
"value, with, commas" - Escaped internal quotes:
"He said ""hi""" - Newlines within fields: multi-line cell values
Nested Objects — Flatten vs. Keep
When Flatten nested objects is on (default), nested objects expand to dot-notation columns:
{ "user": { "name": "Alice", "role": "admin" } }
→ CSV columns: user.name, user.role
When flattening is off, the nested value is serialized as a JSON string:
user.name is replaced by: user → {"name":"Alice","role":"admin"}
Choose flattening for spreadsheet compatibility; keep off when you plan to round-trip the data back to JSON without data loss.
Frequently Asked Questions
Can I convert a large JSON file? Yes. The converter is pure JavaScript running in your browser — performance depends on your device. For very large files (tens of megabytes), consider splitting the data first.
Does the tool preserve field order? In JSON → CSV mode, column order follows the insertion order of the first object’s keys, with any additional keys from later objects appended at the end. In CSV → JSON mode, property order follows the CSV column order.
What happens to array values inside JSON objects?
Array values (e.g., "tags": ["js", "ts"]) are serialized as JSON strings in the CSV output: "[""js"",""ts""]". When converting back to JSON, this value remains a string — round-tripping nested arrays requires manual post-processing.
Why are numbers stored as strings in some tools? CSV is a text format — all values are strings. This tool automatically coerces obvious numeric and boolean strings back to their native types when converting CSV → JSON. If you need to keep all values as strings, that is not currently an option but all values that look like numbers will be typed appropriately.
Is my data private? Yes. All processing happens entirely in your browser. No data is sent to any server, stored in any database, or logged anywhere. The tool works offline once the page loads.
What is the difference between CSV and TSV?
TSV (Tab-Separated Values) uses a tab character (\t) as the delimiter instead of a comma. This tool handles both — select “Tab” from the delimiter dropdown to work with TSV files.