JSON to CSV Converter

JSON Input
1
CSV Output

Last updated:

Jsonic's JSON to CSV converter transforms JSON arrays into comma-separated values. Each object in the array becomes one row; the keys of the first object become column headers. Nested objects are flattened using dot-notation keys (e.g. address.city). Missing keys in some rows are left blank. The result can be copied or downloaded as a .csv file.

How JSON to CSV conversion works

CSV is a flat, two-dimensional table: rows and columns. The cleanest JSON input is therefore an array of similar objects — each object becomes one row, and each key becomes a column. A 100-object array with 5 keys produces a 100-row, 5-column CSV.

[
  { "id": 1, "name": "Alice", "email": "alice@example.com", "active": true },
  { "id": 2, "name": "Bob",   "email": "bob@example.com",   "active": false }
]
id,name,email,active
1,Alice,alice@example.com,true
2,Bob,bob@example.com,false

Headers come from the union of all keys

Column headers should be the union of keys across every object, not just the first. If a later object has an extra key, scanning only the first row truncates it. Objects missing a key get an empty cell.

[
  { "id": 1, "name": "Alice" },
  { "id": 2, "name": "Bob", "team": "Support" }
]

// headers: id,name,team

Flatten nested objects with dot notation

CSV cannot store nested objects, so a field like {"address": {"city": "Paris"}} is flattened to a dotted column header address.city. Arrays of primitives are usually joined into one cell with a delimiter; arrays of objects fit CSV poorly and may be better kept as JSON.

[
  { "id": 1, "name": "Alice", "address": { "city": "Paris", "country": "FR" } }
]

// id,name,address.city,address.country
// 1,Alice,Paris,FR

Escaping commas, quotes, and newlines (RFC 4180)

Any value containing a comma, double quote, or line break is wrapped in double quotes, and inner double quotes are escaped by doubling them. This is what keeps the file parseable in Excel and Google Sheets.

[
  { "note": "Hello, world" },
  { "note": "She said \"yes\"" }
]

// note
// "Hello, world"
// "She said ""yes"""

Convert JSON to CSV in code

When you need conversion in a script or pipeline instead of the browser tool:

# jq (command line) — fast, no install beyond jq
jq -r '(.[0] | keys_unsorted) as $k | $k, (.[] | [.[$k[]]] | @csv)' data.json
# Python — standard library, handles escaping for you
import json, csv, sys
rows = json.load(open("data.json"))
w = csv.DictWriter(sys.stdout, fieldnames=list(rows[0].keys()))
w.writeheader(); w.writerows(rows)
// Node.js — streaming for large files
import { parse } from 'json2csv'
console.log(parse(require('./data.json')))

Common JSON to CSV mistakes

  • Trying to convert one deeply nested object without first deciding what a "row" is.
  • Building headers from only the first object when later rows carry extra keys.
  • Flattening arrays into ambiguous text with no delimiter convention.
  • Letting spreadsheet apps reinterpret IDs, long numbers, and dates — keep them as text on import.

For a step-by-step walkthrough with more examples, see the JSON to CSV tutorial. To go the other way, use CSV to JSON.

How to convert JSON to CSV

  1. Paste a JSON array into the left panel.
  2. Click Convert to produce a CSV.
  3. Nested objects are flattened using dot notation (e.g. address.city).
  4. Click Copy or Download to save the CSV file.

FAQ

Does this support nested JSON objects?

Yes. Nested objects are flattened using dot notation. For example, {"user": {"name": "Alice"}} becomes a column named user.name.

What if the JSON is not an array?

The input must be a JSON array of objects. If you have a single object, wrap it in an array: [{ ... }].

How are null values handled?

Null values are written as empty strings in the CSV output.

Are quotes and commas in values escaped?

Yes. Values containing commas, quotes, or newlines are wrapped in double quotes, and any double quotes inside are escaped by doubling them.

Is my data uploaded?

No. Conversion runs entirely in your browser.

Can I download the CSV?

Yes. Click Download to save a .csv file directly to your computer.

What if array items have different keys?

The converter uses the union of all keys found across all array items. Missing values for a given row are left empty.