JSON to CSV Converter

Convert arrays of JSON objects into CSV format.

What This Tool Does

This converter takes a JSON array of objects and turns it into a CSV (comma-separated values) file. It expects an array where every element is an object — for example, a list of user records or product rows exported from an API. If you paste anything else (a single object, an array of plain strings, or invalid JSON), the tool throws a clear error instead of guessing at a structure.

Real-world JSON arrays don't always have perfectly uniform objects — some records might be missing a field that others have. To handle this, the converter scans every object in the array and builds the CSV header row from the union of all keys it finds, in the order they first appear. Any object that lacks one of those keys simply gets an empty cell in that column, so no data is lost and no row breaks.

Each value is also escaped according to standard CSV rules: if a value contains a comma, a double quote, or a newline, it's wrapped in double quotes, and any double quote inside it is doubled (" becomes ""). This is exactly how Excel and Google Sheets expect quoted fields to look, so the output opens cleanly without misaligned columns. If a value is itself a nested object or array, it's converted with JSON.stringify and placed inline as a single text cell rather than being split into extra columns.

How to Use It

  1. Paste a JSON array of objects into the Input box on this page. Every element must be an object — plain values or a single object without brackets won't work.
  2. Click Run to convert the JSON into CSV.
  3. The Output box fills with the CSV text: a header row of column names followed by one row per object.
  4. Copy the output and paste it into a spreadsheet, or save it as a .csv file for import elsewhere.
  5. Click Clear to reset both fields and start over with a new dataset.

Worked Example

Given this JSON array, notice that the third object is missing a role key, and the second object's address value contains a comma:

[
  { "name": "Alice", "role": "Engineer", "address": "12 Oak St" },
  { "name": "Bob", "role": "Designer", "address": "45 Main St, Suite 2" },
  { "name": "Carol", "address": "9 Pine Ave" }
]

Running it through the converter produces:

name,role,address
Alice,Engineer,12 Oak St
Bob,Designer,"45 Main St, Suite 2"
Carol,,9 Pine Ave

The header row is the union of name, role, and address even though Carol's object never defines role — her cell is just left empty. Bob's address is wrapped in double quotes because it contains a comma, so it stays intact as one field instead of splitting into two columns.

Common Use Cases

FAQ

What if my objects have different keys?

The header row uses the union of all keys found across every object in the array. Objects missing a given key just get an empty cell in that column — nothing errors out.

What if a value is itself an object or array?

It gets serialized with JSON.stringify and placed inline as a single CSV cell, e.g. {"city":"Berlin"}, rather than being flattened into additional columns.

How does the tool handle commas and quotes in values?

Any value containing a comma, double quote, or newline is wrapped in double quotes, and internal double quotes are doubled — the standard CSV escaping convention used by Excel and Google Sheets.

Does my input need to be a JSON array of objects?

Yes. A single object, an array of plain strings or numbers, or malformed JSON will trigger a clear error instead of an attempted conversion, since each row in the CSV must correspond to one object.

Is my data uploaded anywhere?

No. The conversion happens entirely client-side in your browser. Nothing you paste in is sent to a server.

Related Tools & Guides