Online JSON/CSV Converter: Convert Between JSON and Table Formats
What is JSON → CSV
APIs, logs, and configs are often JSON; spreadsheets and BI tools want tables. Turning an array of objects into a 2D CSV is the common bridge. ToolVault's JSON/CSV Converter is the JSON-first write path, fully local in the browser.
If you already have CSV and need a strict RFC-subset parse back to objects, use the bidirectional CSV/JSON Converter. The two pages have different jobs — do not mix expectations.
Example
JSON:
[
{ "name": "Alice", "age": 28, "city": "Shanghai" },
{ "name": "Bob", "age": 32, "city": "Beijing" }
]
CSV (default comma + header):
name,age,city
Alice,28,Shanghai
Bob,32,Beijing
When to prefer which shape
| Scenario | JSON | CSV |
|---|---|---|
| Web APIs | Usual choice | Rare except bulk export |
| Excel / sheets | Not a native table | Native (watch encoding) |
| Nested data | Native | Flatten or stringify into cells |
| Exact types | Clear | All text; conventions only |
| Human editing | Awkward | More practical |
How to use this tool (real options)
Open JSON → CSV:
- Paste JSON: an array of objects is ideal; a single object becomes one row; an array of primitives becomes
index,valuecolumns. - Options:
- Delimiter (default
,; use;or tab for Excel locale dialects). - Include header row.
- Flatten nested objects (on by default) → dotted keys like
address.city. - Guard spreadsheet formulas (on by default) → cells starting with
=,+,-, or@get a leading tab so Excel/WPS treat them as text, not formulas.
- Delimiter (default
- Copy or download
data.csv(text/csv;charset=utf-8).
There is no "auto-detect CSV and convert back" button — use CSV/JSON for the return trip.
Implementer's notes
Nested objects
- With flatten on, plain objects recurse; keys join with
.. - With flatten off, nested objects become a single
JSON.stringify'd cell (properly escaped).
Array fields
- Arrays (including nested arrays) become a JSON string cell, e.g.
["a","b"], not a semicolon join. - Row-wise unnest (one element per row) is out of scope — reshape upstream.
Headers and missing columns
- Header = union of all row keys; missing keys → empty cells.
null/undefined→ empty cell (not the literalnull).- Large integers go through lossless parsing when possible to reduce precision loss.
Quoting
- Fields containing the delimiter,
", or newlines are double-quoted;"→"". - Formula injection: with Guard spreadsheet formulas on (default), values that start with
=,+,-,@, tab, or CR are prefixed with a tab character before quoting. That matches the bidirectional CSV/JSON write path. Turn the guard off only when you intentionally want formula cells for a trusted spreadsheet workflow.
Empty rows, sparse objects, and column order
- Header order follows first-seen key order across rows (union), not alphabetical sort — keep a canary fixture if downstream scripts assume a fixed column index.
- A row missing a key produces an empty cell; it does not drop the column for other rows.
- An empty array input yields an empty string (no header-only file). Feed at least one object when you need a header template.
Large-file boundary
- The whole JSON document is parsed, then all rows are materialized.
- Fine for interactive exports; million-row jobs need server-side streaming.
RFC 4180 and Excel dialects (write side)
Writing CSV is more controllable than reading it, but you still pick a dialect:
- Delimiter: North-American comma vs European semicolon — match the receiver with the delimiter option.
- BOM: some Windows Excel builds need a UTF-8 BOM for CJK text; this download does not force one. Add
EF BB BFor use Excel's text-import wizard with UTF-8 if you see mojibake. - Newlines: output uses
\n; Excel usually accepts it. - Formula injection: spreadsheet apps may treat
=cmd|...as a formula — see above.
Round-trip and type boundaries
JSON → CSV → JSON is not identity:
- Nesting is flattened or stringified — structure is provably lost.
- Numbers become text in CSV; reading back via the bidirectional tool keeps strings (no silent
00123→123). nulland empty string are indistinguishable in CSV.- Array cells come back as strings, not arrays.
- Formula-guarded cells reappear with a leading tab when parsed back unless you strip it — document that in ETL notes.
Canary practice: keep one fixture with nesting, arrays, empties, leading zeros, commas-in-fields, and an =SUM(1) cell; snapshot both directions under fixed options in CI.
When to stop at the browser
Interactive export of a few thousand rows is the sweet spot. Once you need streaming, schema-enforced columns, or nightly dumps into a warehouse, move to a scripted pipeline (jq + csvkit, Spark, or your API's native export). The online page remains useful as a shape debugger: paste a sample payload, confirm flatten/delimiter choices, then copy those decisions into the batch job.
Cluster links
| Goal | Go to |
|---|---|
| Strict CSV → objects | CSV/JSON |
| Normalize separators | CSV/TSV |
| INSERT scaffolding | CSV → SQL |
| SQL layout | SQL formatter |
| Config YAML | JSON ↔ YAML |
| Posts | CSV/JSON guide, CSV→SQL, YAML/JSON |
FAQ
Nested objects?
Turn flatten on for address.city columns, or off to keep a JSON blob in one cell. Both are valid depending on whether humans or programs consume the sheet.
Why [...] instead of a;b?
JSON strings avoid secondary ambiguity when elements themselves contain ;. If you need joins, join upstream first.
Why no CSV → JSON here?
This page is the export lane. Parse rules (quotes, column checks, formula guard) live on CSV/JSON.
Must APIs use JSON?
Almost always for interchange; export CSV when humans download batches. Complementary, not either/or.
From ToolVault. Related: JSON→CSV, CSV/JSON, CSV→SQL, YAML↔JSON. More on the homepage.
Related Tools
Related Articles
JSON Integer Precision Trap: When Snowflake IDs Are Silently Rewritten
JSON numbers beyond 2^53-1 are rounded by JSON.parse. Compare naive formatters with a lossless path, and cross-link JWT, Base64, and this site’s JSON tools.
JSON Parse Error 'Unexpected token'? 5 Common Causes and How to Fix Them
Getting a JSON parse error 'Unexpected token'? This article covers the 5 most common causes of JSON format errors — trailing commas, single quotes, unescaped characters, BOM headers, and comments — with fixes and code examples for each.
JSON Troubleshooting Handbook: From Error Message to Fix (Symptom Index)
JSON errors that make no sense? This handbook organizes fixes by symptom — syntax errors, Unicode escaping, encoding mojibake, and Schema validation failures, with a diagnostic tree and a general debugging workflow.