Convert JSON arrays to CSV with four delimiter options (comma, semicolon, tab, pipe). Auto-detects headers and handles missing fields — download the CSV.
Paste a JSON array of objects
CSV output will appear here
JSON is useful for APIs and application data, while CSV is easier to open in spreadsheets, import into databases, and process with command-line tools. This converter accepts a JSON array of objects, discovers columns from every object, and writes one CSV row per array element.
Input:
[
{"name": "Alice", "age": 30},
{"name": "Bob", "city": "London"}
]
Output:
name,age,city
Alice,30,
Bob,,London
Headers use the order in which keys first appear. Missing properties become empty cells, so records with different shapes can still be exported as one table.
| Delimiter | Common use | Example |
|---|---|---|
| Comma | General CSV files and most APIs | name,age |
| Semicolon | Locales where comma is a decimal separator | name;age |
| Tab | Spreadsheet paste and TSV workflows | name<TAB>age |
| Pipe | Data containing many commas | `name |
Select the delimiter expected by the destination application. A file can be valid CSV while still importing incorrectly if spreadsheet locale settings expect a different separator.
CSV cells containing a delimiter, quotation mark, or line break are wrapped in double quotes. A quotation mark inside a quoted cell is represented by two quotation marks:
[
{"name": "Ada", "note": "He said \"hello\"", "tags": ["math", "logic"]}
]
name,note,tags
Ada,"He said ""hello""","[""math"",""logic""]"
Objects and arrays are serialized as JSON text inside one cell. Flatten nested data first when the destination requires one scalar value per column.
const rows = [
{ name: "Alice", age: 30 },
{ name: "Bob", city: "London" },
];
const headers = [...new Set(rows.flatMap((row) => Object.keys(row)))];
const csv = [
headers.join(","),
...rows.map((row) => headers.map((header) => row[header] ?? "").join(",")),
].join("\n");
import csv
import json
import sys
rows = json.load(sys.stdin)
headers = list(dict.fromkeys(key for row in rows for key in row))
writer = csv.DictWriter(sys.stdout, fieldnames=headers)
writer.writeheader()
writer.writerows(rows)
jq -r '(map(keys) | add | unique) as $headers
| $headers, (.[] | [.[$headers[]]]) | @csv' input.json
Use a library when processing untrusted or very large files in production. It will handle encoding, streaming, and edge cases that are easy to miss in a short script.
Conversion happens locally in the browser. The tool does not validate a business schema, infer data types, or flatten nested structures; it only maps JSON object keys and values into escaped CSV cells.
This tool is provided for general informational and utility purposes only. Results may be inaccurate, incomplete, outdated, or contain errors. Always verify results before relying on or using them.
Some tools may use AI, automated processing, third-party services, or server-side processing. Do not rely on these tools as a substitute for professional advice.
Use at your own risk. BestToolOnline makes no guarantees regarding the accuracy, reliability, completeness, availability, or suitability of results, to the maximum extent permitted by applicable law.
See our Terms of Service and Privacy Policy for complete details.