UUID Studio

JSON to CSV

Flatten JSON arrays into comma-separated rows.

  • 🔒 No data stored or uploaded
  • âš¡ 100% client-side
  • 🆓 Free, no account

Need more than one tool at a time? Open the full Workbench - or press Ctrl+K to jump to any tool.

Create or edit JSON here (syntax colors), then format, validate, or convert - same as MongoDB $binary UUID blobs on the Convert tab once detected.

New document

About JSON to CSV

CSV is a flat grid and JSON is a tree, so this conversion is fundamentally a flattening - and everything tricky about it follows from that.

Nested objects have to be projected into columns, usually with dotted paths: {"user":{"name":"Ada"}} becomes a user.name column. Nested arrays are worse, because there is no single correct answer - you can join the values into one cell, spread them across numbered columns, or explode one row into several. Each choice loses something, and which is right depends entirely on what the spreadsheet is for.

The other half of the difficulty is CSV itself, which is far less standardised than people assume. Values containing a comma, a double quote or a newline must be quoted, with embedded quotes doubled. Excel then adds its own problems: it will reinterpret a value that looks like a date, strip leading zeros from postcodes and IDs, and turn a long numeric id into scientific notation - all silently, on open, corrupting data that was perfectly correct in the file.

This runs in your browser, so a real payload is never uploaded - which matters when the document you are converting is a production API response rather than a toy example.

How to use the JSON to CSV

  1. Paste the JSON. If it does not parse, fix that first - the error will name the position.
  2. Convert, and read the CSV output.
  3. Check the specific cases listed below before relying on the result - CSV and JSON do not model data identically.
  4. Copy the output, or convert back to confirm the round trip does what you expect.

Examples

  • Array of objects
    [{"id":1,"name":"A"},{"id":2,"name":"B"}]

When you need this

  • Turning an API response into CSV for a config file, a spreadsheet, or a type definition.
  • Producing a CSV fixture from real data rather than writing it by hand.
  • Checking how a nested structure maps into CSV before committing to it.
  • Converting a sample from documentation into the form your tooling needs.

Common problems and what causes them

Excel mangling values on open
Excel converts anything date-like (2024-01-02, or the gene name SEPT1), strips leading zeros from ZIP codes and account numbers, and renders integers above 15 digits in scientific notation - losing digits permanently if the file is then saved. Prefix values with a tab, or import as text rather than double-clicking the file.
Values containing the delimiter or a newline
A field with a comma, a double quote or a line break must be wrapped in double quotes, with internal quotes doubled ("" for one "). Naive string joining produces a file that misaligns from that row onward.
Nested arrays with no good mapping
There is no correct flattening for {"tags":["a","b"]}. You can join to one cell ("a;b"), spread to tags.0 and tags.1, or explode into two rows. All three lose something; choose based on what the consumer needs.
Inconsistent keys across records
JSON objects in an array need not share keys, but CSV needs one fixed header row. The usual approach is to take the union of all keys and leave blanks, which requires reading the whole document before writing any of it.
null versus empty string
CSV has no null. Both become an empty field and cannot be distinguished on re-import, which matters when an API treats missing and null differently.
Encoding and the BOM
Excel on Windows assumes the local codepage unless the file begins with a UTF-8 BOM, so accented characters and CJK arrive corrupted. Write a BOM for Excel - and be aware it will confuse strict parsers elsewhere.

FAQ

How are nested JSON objects converted to CSV columns?
By flattening the path into a column name, usually dot-separated: {"user":{"name":"Ada"}} becomes a user.name column. Deeply nested documents produce very wide files, which is a sign CSV may be the wrong target.
What happens to arrays?
There is no single correct mapping. Common options are joining values into one cell with a separator, spreading them into numbered columns, or exploding one record into multiple rows. Each loses different information.
Why does Excel corrupt my CSV?
It applies type inference on open: date-like strings become dates, leading zeros are stripped from IDs and postcodes, and long numbers become scientific notation. Import as text via the data import wizard instead of double-clicking, or prefix values with a tab.
When should I not use CSV?
When the data is genuinely nested, when null and empty string must be distinguished, or when field types must survive. In those cases JSON Lines - one JSON object per line - keeps the structure while remaining streamable and greppable.
Is my data uploaded when I convert it here?
No. The conversion runs entirely in your browser with no network request, so pasting a real payload does not transmit it. The page works offline once loaded.
What about nested objects?
Deep nesting may produce wide or sparse columns; flatten complex trees in JSON first if needed.

Related reading