JSON to CSV Converter

Convert a JSON array of objects to CSV locally: columns are the union of object keys, and values containing commas, quotes or newlines are quoted and escaped automatically.

Loading calculator…

What this tool does

Convert a JSON array of objects to CSV locally: columns are the union of object keys, and values containing commas, quotes or newlines are quoted and escaped automatically. Input must be a JSON array of objects (a single object is treated as a one-row array). Nested objects/arrays are written as compact JSON text inside the cell. Input is capped at 200,000 characters.

How to use the JSON to CSV Converter

  1. Enter or select json array of objects.
  2. Read the calculated result; change any measurement to compare alternatives.

Formula

Parse JSON; collect the union of keys in first-seen order as the header; serialise each object as one CSV row, quoting fields that contain commas, quotes or newlines (RFC 4180 style).
value
JSON array of objects

Input must be a JSON array of objects (a single object is treated as a one-row array). Nested objects/arrays are written as compact JSON text inside the cell. Input is capped at 200,000 characters.

Worked example

For json to csv converter, the following measurements illustrate the exact method: JSON array of objects: [{"name":"Ada","role":"Coach","sessions":12},{"name":"Ben","role":"Client","sessions":8}].

Inputs

  • JSON array of objects[{"name":"Ada","role":"Coach","sessions":12},{"name":"Ben","role":"Client","sessions":8}]

Result

  • CSVname,role,sessions Ada,Coach,12 Ben,Client,8
  • Rows2
  • Columns3

Results explained

CSV
CSV from the formula above. Input must be a JSON array of objects (a single object is treated as a one-row array). Nested objects/arrays are written as compact JSON text inside the cell. Input is capped at 200,000 characters.
Rows
Rows from the formula above. Input must be a JSON array of objects (a single object is treated as a one-row array). Nested objects/arrays are written as compact JSON text inside the cell. Input is capped at 200,000 characters.
Columns
Columns from the formula above. Input must be a JSON array of objects (a single object is treated as a one-row array). Nested objects/arrays are written as compact JSON text inside the cell. Input is capped at 200,000 characters.

Frequently asked questions

An array of flat objects, e.g. [{"name":"Ada","sessions":12}]. Keys become columns; the union of all keys is used, so objects missing a key simply leave that cell empty.

Any field containing a comma, double quote or newline is wrapped in double quotes, and inner quotes are doubled — the standard RFC 4180 escaping that spreadsheet apps expect.

They are written as compact JSON text inside a quoted cell. CSV has no nested structure, so flatten data first if you need nested values as separate columns.

No. Parsing and serialising happen in your browser only.

The input must be valid JSON whose top level is an array or object. JSON with trailing commas, single quotes or comments will fail — run it through the JSON Formatter first if unsure.