JSON to CSV

Convert JSON arrays into CSV instantly

Paste JSON on the left and copy CSV on the right — all in your browser

Last updated: February 6, 2026
Frank Zhao - Creator
CreatorFrank Zhao
The converted CSV will appear here

Introduction / overview

The JSON to CSV converter turns a JSON array of objects into a CSV table. It automatically detects column headers by scanning keys across the whole array, then produces one header row and one row per object.

Who typically uses it?

  • Developers exporting API responses to a spreadsheet.
  • Analysts doing quick checks in Excel/Sheets before deeper modeling.
  • Ops teams preparing import files for CRM, ticketing, or data warehouses.

Privacy note

All conversion runs locally in your browser. If you’re working with sensitive data, you can still use this tool—just avoid sharing URLs with embedded input.

If you’re juggling formats, pairing this with our JSON to YAML converter or YAML to JSON converter can make debugging and editing much easier.

How to use / quick start

  1. 1Paste a JSON array into the left box. The best format is [{...},{...}][\{...\},\{...\}] (an array of objects).
  2. 2Confirm the output on the right looks like a spreadsheet: a header row followed by one row per object.
  3. 3Click the copy button and paste into Excel/Sheets, or save it as a .csv\texttt{.csv} file.

Worked example (header detection)

Suppose your API returns two records:

[
  { "id": 1, "name": "Ada" },
  { "id": 2, "name": "Linus", "team": "Kernel" }
]

The tool builds the header set HH from all keys, so: H={id,name,team}H = \{\texttt{id},\texttt{name},\texttt{team}\}and H=3|H|=3 columns are produced.

A typical CSV output will look like:

id,name,team
1,Ada,
2,Linus,Kernel

Notice how the first row has an empty value for team\texttt{team}. That’s expected when a key is missing in some objects.

If the output is blank

Your JSON may be valid but not an array of objects. Wrap a single object as an array, like [{...}][\{\texttt{...}\}].

Real-world examples / use cases

1) Exporting API data to a spreadsheet

Background: You fetched a list of issues from an API and want a quick pivot table in Sheets.

Input JSON (simplified):

[
  { "id": 101, "status": "open", "assignee": "Sam" },
  { "id": 102, "status": "closed", "assignee": "Alex" }
]

Result: a CSV table with H=3|H|=3 columns. You can paste it directly into Sheets.

Tip: if the API returns YAML in logs, convert it first using our YAML to JSON converter.

2) Creating an import file (CRM / ticketing)

Background: Your tool accepts CSV imports, but your source data is JSON.

Example input:

[
  { "email": "[email protected]", "plan": "Pro" },
  { "email": "[email protected]", "plan": "Free" }
]

Result CSV gives you two columns. In symbols: H={email,plan}H=\{\texttt{email},\texttt{plan}\}.

How to apply it: save as users.csv\texttt{users.csv} and import.

3) Sanitizing and sharing a non-sensitive sample

Background: You want to share a minimal reproduction with teammates. Convert to CSV so it’s easy to read and compare.

Input values are small by design; if you share a URL with results, remember the query-string limit. If you need safer sharing, share a file instead.

Common scenarios / when to use

You need a quick spreadsheet view

Paste your JSON array and instantly get a tabular view you can copy into Excel or Google Sheets.

You’re debugging inconsistent objects

Automatic header detection makes missing keys show up as empty cells, which is often easier to spot than scanning raw JSON.

You want local-only processing

This converter runs in your browser, so you can transform data without uploading it to a server.

You’re moving between formats

Convert JSON ↔ YAML first when needed, then output CSV for tools that only accept tables.

It’s useful, but not always the right tool

If your JSON is deeply nested, a simple CSV may lose structure. In that case, consider flattening upstream or exporting as JSON Lines.

You’re preparing an import template

Convert a sample dataset to CSV, then adjust headers to match the importer’s expected columns.

Tips & best practices

Keep your JSON “row-like”

CSV works best when each object represents one row and each key is a column. If you have nested objects, convert/flatten them before exporting.

Watch out for commas and line breaks

Values containing commas are quoted in the output. Line breaks are escaped as n\\n and r\\r, which avoids breaking rows in most spreadsheet pastes.

Convert first, then export

If your source is XML or YAML, convert it to JSON first with XML to JSON or YAML to JSON, then paste it here for CSV output.

Calculation method / formula explanation

Think of your JSON input as a list of records: A=[o1,o2,,on]A=[o_1,o_2,\ldots,o_n]. Each oio_i is an object with key-value pairs.

Header detection

The converter builds the header set by taking the union of keys across all objects:

H=i=1nkeys(oi)H = \bigcup_{i=1}^{n} \mathrm{keys}(o_i)

The number of columns is simply H|H|.

Row construction

For each object oio_i and each header hHh\in H, the cell value is: vi,h=oi[h]v_{i,h}=o_i[h].

rowi\mathrm{row}_i==(vi,h1,vi,h2,,vi,hH)\big(v_{i,h_1},v_{i,h_2},\ldots,v_{i,h_{|H|}}\big)==(oi[h1],oi[h2],,oi[hH])\big(o_i[h_1],o_i[h_2],\ldots,o_i[h_{|H|}]\big)

Missing keys produce empty cells. A JSON null\texttt{null} becomes the text null\texttt{null} in CSV.

Related concepts / background info

CSV is a format, not a schema

CSV doesn’t tell you column types; everything looks like text at first. If you need strict typing, store the original JSON as well.

JSON5 parsing

The parser is forgiving (comments and trailing commas may work), which is handy when you copy from logs or config-like JSON.

If you need to view JSON more comfortably before exporting, try our JSON diff tool for side-by-side comparisons.

Frequently asked questions (FAQs)

Why do I get an error saying the JSON is not valid?

The input must be parseable JSON/JSON5. Double-check missing quotes, unclosed braces, and trailing characters. If you copied from YAML, convert it first with our YAML to JSON converter.

My JSON is valid, but the CSV output is empty—why?

This tool expects [{...},{...}][\{...\},\{...\}]. If you have a single object, wrap it as an array: [{...}][\{...\}].

Does it flatten nested objects?

No—nested objects stay as JavaScript objects, which typically become [object Object]\texttt{[object\ Object]} if coerced. For nested data, flatten upstream or export a different format.

How are commas, quotes, and newlines handled?

Values containing commas are quoted. Quotes are escaped, and line breaks are replaced with n\\n and r\\r.

Can I share my input with the Share button?

Yes, but only if you check “share with results”. If the data is sensitive, leave that unchecked and share the page URL only.

Limitations / disclaimers

Not a full CSV spec implementation

CSV has edge cases (different delimiters, embedded quotes, Excel quirks). This tool targets the common “copy/paste” workflow.

Nested or relational data may not fit

If your JSON contains arrays-in-arrays or nested objects, a single table may be the wrong representation. Consider exporting multiple tables or using a database.

External references

External references / sources

For day-to-day use, the “best” CSV handling depends on your destination tool (Excel vs a database import). If you need stricter handling, consider a dedicated CSV library in your pipeline.

JSON to CSV | CalculatorVast