How to convert JSON to CSV online
jsonsql.dev converts JSON arrays to CSV instantly in your browser. No data is sent to any server — your JSON stays on your machine.
Paste your JSON array — copy a JSON array of objects from your API response, database export, or code and paste it into the input editor on the left. You can also drag and drop a .json file.
Choose your options — select a delimiter (comma, tab, semicolon, or pipe), toggle header row, quote all values, or flatten nested objects with dot notation.
Copy or download — click Copy to copy the CSV to your clipboard, or Download to save it as a .csv or .tsv file.
How to convert CSV to JSON online
jsonsql.dev converts CSV to JSON instantly in your browser. No data is sent to any server — your data stays on your machine.
Paste your CSV — copy CSV from a spreadsheet, database export, or text file and paste it into the input editor on the left. The delimiter is auto-detected (comma, tab, semicolon, or pipe).
Configure options — toggle "First row as headers" to use the first row as JSON keys. Enable "Parse numbers" and "Parse booleans" to auto-convert values. Choose between array of objects or array of arrays output.
Copy or download the result — click Copy to copy the JSON to your clipboard, or Download to save it as a .json file.
How nested JSON is flattened to CSV
Nested JSON objects are flattened to CSV columns using dot notation — for example, {"address": {"city": "NYC"}} becomes a column named address.city. This approach preserves the hierarchy in a flat, spreadsheet-friendly format.
When you enable the Flatten nested option, each nested key path becomes its own column header. Arrays within values are joined with semicolons.
Input (nested JSON):
[
{
"id": 1,
"name": "Acme Corp",
"address": {
"street": "123 Main St",
"city": "New York",
"state": "NY"
},
"contact": {
"email": "[email protected]",
"phone": {
"office": "555-0100",
"mobile": "555-0101"
}
}
},
{
"id": 2,
"name": "Globex Inc",
"address": {
"street": "456 Oak Ave",
"city": "Chicago",
"state": "IL"
},
"contact": {
"email": "[email protected]",
"phone": {
"office": "555-0200",
"mobile": "555-0201"
}
}
}
]Output (flattened CSV):
id,name,address.street,address.city,address.state,contact.email,contact.phone.office,contact.phone.mobile
1,Acme Corp,123 Main St,New York,NY,[email protected],555-0100,555-0101
2,Globex Inc,456 Oak Ave,Chicago,IL,[email protected],555-0200,555-0201CSV parsing rules (RFC 4180)
RFC 4180 defines the CSV format: fields containing commas, newlines, or double quotes must be enclosed in double quotes, and literal double quotes are escaped by doubling them. This standard ensures interoperability between different tools and platforms.
- Field separator: Fields are separated by a delimiter character. The default is a comma (
,), but other delimiters like tab, semicolon, or pipe are common in practice. - Quoted fields: Any field that contains the delimiter character, a newline, or a double quote must be enclosed in double quotes. For example:
"San Francisco, CA"is a single field. - Escaping double quotes: A double quote inside a quoted field is escaped by writing two double quotes. For example:
"She said ""hello"""represents the valueShe said "hello". - Trailing newline: A trailing newline at the end of the file is optional. Most parsers handle both cases correctly.
- Line endings: Both
\r\n(Windows) and\n(Unix) line endings are accepted. Our converter handles both automatically.
JSON to CSV type mapping
When converting JSON values to CSV, each JSON type is mapped to a CSV string representation:
| JSON Type | CSV Representation | Example |
|---|---|---|
| String | As-is (quoted if contains delimiter) | "hello" → hello |
| Number | Numeric string | 42 → 42 |
| Boolean | true / false | true → true |
| Null | Empty string | null → (empty) |
| Array | Semicolon-joined values | ["a","b"] → a;b |
| Object (flat) | Dot-notation columns | {"a":{"b":1}} → column a.b |
| Object (no flatten) | JSON stringified | {"a":1} → {"a":1} |
Code examples
Python
import csv, json, io
# JSON to CSV
data = json.loads(json_string)
output = io.StringIO()
writer = csv.DictWriter(output, fieldnames=data[0].keys())
writer.writeheader()
writer.writerows(data)
csv_string = output.getvalue()
# CSV to JSON
reader = csv.DictReader(io.StringIO(csv_string))
json_data = [row for row in reader]
json_string = json.dumps(json_data, indent=2)Node.js
// JSON to CSV (using json2csv)
import { Parser } from 'json2csv';
const parser = new Parser({ flatten: true });
const csv = parser.parse(jsonArray);
// CSV to JSON (using Papa Parse)
import Papa from 'papaparse';
const result = Papa.parse(csvString, {
header: true,
dynamicTyping: true,
skipEmptyLines: true
});
const json = result.data;CLI (jq + csvkit)
# JSON to CSV
cat data.json | jq -r '(.[0] | keys_unsorted) as $keys | $keys, (.[] | [.[$keys[]]] ) | @csv' > out.csv
# CSV to JSON
csvjson data.csv > out.jsonJSON ↔ CSV vs other tools
| Feature | jsonsql.dev | csvjson.com | jq + csvkit (CLI) | pandas (Python) |
|---|---|---|---|---|
| Browser-based | Yes | Yes | No (CLI) | No (Python) |
| Client-side only | Yes | No (server) | Yes (local) | Yes (local) |
| Bidirectional | Yes (one page) | Separate pages | Separate tools | Yes |
| Flatten nested objects | Yes (dot notation) | Limited | Manual | json_normalize |
| Auto-detect delimiter | Yes | Limited | Yes (csvkit) | Yes (sniffer) |
| Parse numbers/booleans | Yes (toggle) | Limited | Manual | Yes |
| Handle quoted fields (RFC 4180) | Yes | Yes | Yes | Yes |
| Drag & drop files | Yes | Yes | N/A | N/A |
| Dark mode | Yes | No | N/A | N/A |
| No install needed | Yes | Yes | No | No |
Related tools
Frequently asked questions
How are nested JSON objects handled in CSV?
When "Flatten nested" is enabled, nested objects are flattened using dot notation. For example, {"address": {"city": "NYC"}} becomes a column named "address.city". Without flattening, nested objects are JSON-stringified.
What delimiters are supported?
For JSON → CSV output: comma, tab (TSV), semicolon, and pipe. For CSV → JSON input: the delimiter is auto-detected from comma, tab, semicolon, and pipe characters.
What is RFC 4180 and how does this tool comply?
RFC 4180 is the standard that defines the CSV format. It specifies that fields containing commas, newlines, or double quotes must be enclosed in double quotes, and literal double quotes are escaped by doubling them (""). Our parser fully complies with this standard.
How are arrays inside JSON objects handled?
Array values are joined with semicolons by default. For example, ["JavaScript", "Python"] becomes "JavaScript;Python" in the CSV output.
What is the difference between CSV and TSV?
CSV uses commas as field separators, while TSV uses tab characters. TSV is often preferred when field values contain commas, since tabs rarely appear in data. Both formats are supported by this converter.
Can I parse numbers and booleans automatically from CSV?
Yes. In CSV → JSON mode, enable "Parse numbers" to convert numeric strings to JSON numbers, and "Parse booleans" to convert true/false strings to JSON boolean values.