PasteSheet icon PasteSheet logo mark — a spreadsheet grid with a curly brace on a green rounded square PasteSheet

Convert JSON to CSV

Paste a JSON array of objects and get CSV back. The header row is the union of every key across your objects, so an object missing a field produces an empty cell rather than a shifted row.

Your JSON

Nothing is stored.

Key facts

  • RFC 4180 requires that a field containing a comma, a double quote, or a line break be enclosed in double quotes, with literal quotes escaped by doubling them — the escaping this converter applies. source
  • Under RFC 8259 an object is an unordered collection of name/value pairs, so key order across objects is not guaranteed. The header row is built from the union of all keys in first-seen order rather than from the first object alone. source
  • The conversion is necessarily lossy: CSV has no type system, so 42, "42" and true all arrive as text, and null is indistinguishable from an empty string.
  • There is no formal CSV standard — RFC 4180 documents common usage and registers the text/csv MIME type, which is why importers disagree over delimiters and line endings. source

How it handles ragged objects

CSV is rectangular and JSON is not, which is the whole difficulty. The header row is built from the union of every key across every object, in first-seen order. An object that is missing one of those keys gets an empty cell for it, rather than having its remaining values shift left into the wrong columns.

Values are escaped per RFC 4180: anything containing a comma, a double quote or a newline is quoted, and literal quotes are doubled. Nested objects and arrays are serialised back to compact JSON inside their cell, because a CSV cell cannot hold structure.

What the output looks like

output.csv
name,role
"Lovelace, Ada",Engineer
"Grace ""Amazing Grace"" Hopper",Admiral

The conversion is lossy, and it has to be

JSON is a tree; CSV is a grid. Anything that only a tree can express has to be flattened, stringified, or dropped, and no converter escapes that — the only real choice is whether it tells you.

Three things change on the way across. Types disappear: 42, "42", and true all become bare text, and nothing downstream can tell them apart. Null and empty string collapse into the same empty cell. Nested structure gets serialised into a cell as compact JSON, which is honest but not queryable.

If you control both ends and the data is genuinely tabular, none of this hurts. If you are round-tripping JSON → CSV → JSON, expect to do explicit casting on the way back.

Before you paste it into a spreadsheet

CSV usually exists because something else has to open it. A few things to check first:

  • Long numeric IDs. Excel and Sheets will happily reformat a 17-digit order number into scientific notation. Import as text if the value is an identifier rather than a quantity.
  • Leading zeros. Postcodes and product codes lose them on import unless the column is typed as text first.
  • Values starting with =, +, or -. A spreadsheet reads them as formulas. This is a real injection vector when the CSV is generated from user input.
  • Date-like strings. 2026-07-26 becomes a date object with a locale-dependent display; the string you get back out may not be the one you put in.
  • Embedded newlines. Legal in quoted CSV, but some importers still split the row. Check the row count after import, not just the first screen.

Going the other way

Need the reverse? Convert CSV to JSON. And if the JSON is coming out of a spreadsheet in the first place, a PasteSheet endpoint serves it as JSON at a live URL, so you can skip the export-and-convert round trip entirely.

Frequently asked questions

What if my objects have different keys?

The header row is the union of every key across every object, in first-seen order, and an object missing a key gets an empty cell for it. That keeps the output rectangular — the alternative, using only the first object's keys, silently drops data that appears later in the array.

What happens to nested objects and arrays?

They are serialised back to compact JSON inside the cell. A CSV cell holds a string and nothing else, so there is no lossless way to flatten arbitrary structure into one — keeping it as JSON at least means nothing is thrown away.

Does it accept a single object rather than an array?

Yes. A single JSON object is treated as a one-row array, so you get a header row and one data row. Anything that is not an object or an array of objects cannot become a table, and the tool will tell you so rather than guessing.

Is converting JSON to CSV lossy?

Yes, unavoidably. JSON is a tree and CSV is a grid, so types are erased, null and empty string collapse into the same empty cell, and nested structure is serialised into a cell as compact JSON. For flat, tabular data none of that matters; for round-tripping it does.

Why did my long ID turn into scientific notation?

That is the spreadsheet, not the CSV. Excel and Google Sheets reformat long numeric strings on import. Set the column type to text before importing, or prefix the value, if the number is an identifier rather than a quantity.

Can a CSV cell contain a formula?

A spreadsheet will treat any value starting with =, +, or - as a formula on import. If your JSON came from user input, that is a genuine injection risk worth sanitising before the file reaches anyone else.

What delimiter does it use?

A comma, per RFC 4180. If your target expects semicolons — common in locales where the comma is a decimal separator — you will need to swap the delimiter after conversion.

Sources

Related tools

Turn your sheet into an API in minutes

Paste a Google Sheet URL and get a live REST API and MCP server — no backend, no code, free to start.