All tools
Free · Private · No upload

Convert JSON to CSV Online

Flatten a JSON array, or an API response that contains one, into CSV with one row per object. The JSON is parsed in your browser and never uploaded.

Drop a CSV or Excel file here

CSV · XLSX · XLS · XLSM · XLSB

or paste your data below

How to convert JSON to CSV

Three steps from users.json to CSV.

1. Paste the JSON

Paste JSON or drop a .json file. Arrays, keyed objects and JSON Lines all work.

2. Check it in the grid

Look for columns holding [...] or {...}: those are nested values written as JSON text. Split them into separate columns here if the CSV is going into a spreadsheet.

3. Choose a delimiter

Comma, semicolon, tab or pipe. The text updates as you switch; copy it or download data.csv.

Example: JSON in, CSV out

An API-style response: the rows sit in a "users" array, the objects have different keys, and one value is a nested array.

users.json
{
  "total": 2,
  "users": [
    { "id": 7, "name": "Mia", "active": true, "tags": ["admin", "ops"] },
    { "id": 8, "name": "Noah", "active": false, "email": "[email protected]" }
  ]
}
data.csv (default options)
id,name,active,tags,email
7,Mia,true,"[""admin"",""ops""]",
8,Noah,false,,[email protected]

The tags array becomes one quoted field, "[""admin"",""ops""]": the inner quotes are doubled, as CSV requires, and a spreadsheet shows it as ["admin","ops"].

What changes between JSON and CSV

Quoting

A value is put in double quotes only when it contains the delimiter, a double quote or a line break, and inner quotes are doubled. Here the value ["admin","ops"] is written as "[""admin"",""ops""]".

Header line

The header row (id,name,active,tags,email) is the first line. Untick "First row as header" and only the data rows are written.

The array inside is found

The top level is an object, not a table, so the largest array of objects among its properties is used: "users". "total" is ignored.

When to convert JSON to CSV

JSON to CSV in JavaScript

JSON needs no parser: JSON.parse gives you the data. Then each field is quoted only where CSV needs it.

import { readFile } from 'node:fs/promises';

const { users } = JSON.parse(await readFile('users.json', 'utf8'));
const toText = (v) => (v == null ? '' : typeof v === 'object' ? JSON.stringify(v) : String(v));
const header = [...new Set(users.flatMap((o) => Object.keys(o)))];
const rows = users.map((o) => header.map((key) => toText(o[key])));

const field = (v) => {
  const s = String(v ?? '');
  return /[",\n]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
};
console.log([header, ...rows].map((row) => row.map(field).join(',')).join('\n'));

TabularJS reads spreadsheet files, not JSON; JSON.parse is all JSON needs.

npm install tabularjs MIT licensed

Frequently asked questions

Are nested objects split into separate columns?

No. A nested object or array stays in one cell as JSON text. To get columns like address.city, flatten the objects in code before converting, or split the column in the grid.

Can I choose which fields become columns?

Every key becomes a column. Delete the ones you don't want in the grid before you copy the CSV, or map the objects to the fields you need in code first.

My JSON is wrapped in an object like {"data": [...]}. Will it work?

Yes. When the top level is not a table, the largest array of objects among its properties is used, and other properties (counts, paging links) are ignored.

When are values wrapped in quotes?

Only when needed: if a value contains the chosen delimiter, a double quote or a line break. Inner double quotes are doubled (" becomes ""), which is the standard CSV rule (RFC 4180).

Does users.json get uploaded when I convert it to CSV?

No. The JSON is parsed in your browser and never uploaded.