JSON→CSV

Convert JSON to CSV

Turn a .json array into a flat, spreadsheet-ready CSV — right in your browser. The tool collects every key across all your objects as columns (even when they don't all match), escapes fields correctly, and lets you download the result. Nothing is uploaded.

Runs 100% in your browser Handles mismatched keys RFC 4180 output

Convert a JSON File to CSV

Drop a .json file below — an array of objects (the most common case, e.g. an API export), an array of arrays, or a single object. It's parsed and flattened to a real CSV right in your browser, previewed, and ready to download.

Before you use this tool: Nested objects and arrays remain JSON text inside CSV cells; this tool does not expand every nested key into a separate column. Use the flattening examples below when you need those columns. Review the output before importing it into a spreadsheet.

🔒 Nothing is uploaded — your file never leaves this device

How the JSON-to-CSV conversion works

JSON can express structure CSV can't (nested objects, arrays, differing shapes across records). Turning it into a flat table means making real decisions about how to flatten it, which this tool does transparently:

  • Column detection — for an array of objects, the tool scans every object and builds the column list from the union of all keys it finds, in first-seen order, rather than assuming every object matches the first one's shape.
  • Missing keys — if an object doesn't have a given key, its cell for that column is left empty, keeping every row properly aligned.
  • Nested values — an object or array found as a value is serialized as compact JSON text in that cell, since CSV has no way to represent nesting natively.
  • Escaping — any value containing a comma, quote or line break is quoted and escaped per RFC 4180, so the output opens correctly in Excel, Google Sheets or any CSV parser.

Why convert JSON to CSV

JSON is what most APIs return, but spreadsheets, BI tools and most non-technical collaborators want a flat table. Converting an API response or export into CSV is the fastest way to open it in Excel or Google Sheets, filter and sort it, or hand it to someone who doesn't work with JSON directly.

Edge cases this tool handles

Objects with different keys

Common with real-world API data where optional fields are sometimes omitted — the tool builds one consistent column set from every object seen, rather than only using the first object's keys.

Nested objects and arrays

Serialized as compact JSON text inside the cell, so no data is silently lost.

A single object instead of an array

Converted to a one-row CSV using that object's own keys as columns.

Values containing commas, quotes or line breaks

Correctly quoted and escaped per RFC 4180 so the file opens cleanly.

Flattening nested JSON into separate columns

This tool keeps a nested value in one cell as JSON text, so a record like {"id": 7, "customer": {"name": "Ana", "city": "Austin"}} gives you a customer column containing {"name":"Ana","city":"Austin"}. That never loses data, but if you want customer.name and customer.city as real columns — or one row per line item — flatten it first with one of these.

pandas: json_normalize

pd.json_normalize() expands nested objects into dotted column names. Lists stay in a single cell, so for an array such as an order's items, use record_path to get one row per element and meta to repeat the parent fields:

json_normalize turning nested customer fields into columns, and record_path producing one CSV row per line item.

jq: flat, nested or both

For JSON that's already flat, the classic recipe is jq -r '(map(keys_unsorted) | add | unique) as $k | $k, (.[] | [.[$k[]]]) | @csv' orders.json > orders.csv. On nested data it stops with an error like object (…) is not valid in a csv row, because @csv only accepts plain values. Flatten every leaf to a dotted path first:

jq -r 'map([paths(scalars) as $p | {($p | map(tostring) | join(".")): getpath($p)}] | add) | (map(keys_unsorted) | add | unique) as $k | $k, (.[] | [.[$k[]]]) | @csv' orders.json > orders.csv

Arrays become numbered columns (items.0.sku, items.1.sku…) and the columns come out sorted alphabetically. Both recipes were tested with jq 1.7.

Excel: Power Query

  1. Go to Data > Get Data > From File > From JSON and pick the file. The Power Query Editor opens.
  2. If you see a single List, click To Table (List Tools > Transform), then OK.
  3. Click the expand icon (two outward arrows) in the column header, tick the fields you want, and repeat for any column that still says Record. A column of List values expands into extra rows.
  4. Close & Load, then File > Save As and choose CSV UTF-8 (Comma delimited) (*.csv).

JSON Lines, wrapped API responses and other shapes

A .jsonl or .ndjson file (one object per line)

JSON Lines isn't a single JSON document, so a file with more than one line is rejected as invalid JSON. Wrap the lines into an array first with jq -s '.' events.jsonl > events.json and convert that, or skip the step with pandas: pd.read_json("events.jsonl", lines=True).to_csv("events.csv", index=False).

The CSV has only one row

Most APIs wrap the records you want inside an object, such as {"data": [ … ], "page": 1}. That top-level object is treated as one record, so the whole array ends up as text in a data column. Pull the array out first — jq '.data' response.json > data.json — or open the file in the JSON viewer to find which key holds the list, copy just that part into a new file, and convert again.

Opening the result in Excel

The CSV is written as UTF-8 without a byte-order mark, which every database and script reads correctly, but Excel for Windows may show accented letters as "é" on a double-click. Import it with Data > From Text/CSV and File Origin set to UTF-8, or convert the CSV straight to a workbook with the CSV to XLSX converter.

Frequently asked questions

Does converting JSON to CSV upload my file anywhere?

No. This tool parses and converts the file entirely inside your browser using JavaScript — the file's contents never leave your device or touch a server.

What if my JSON objects don't all have the same keys?

The tool collects the union of every key it sees across all objects, in the order they first appear, and uses that as the column set. Any object missing a given key simply gets an empty cell for that column, so the resulting table is always fully aligned — nothing is dropped or misaligned.

What happens to nested objects or arrays inside my JSON?

CSV can't represent nesting, so a nested object or array value is serialized as compact JSON text inside that single cell, rather than being silently dropped or exploded into unpredictable extra columns.

Does it work with a single JSON object instead of an array?

Yes — a single top-level object is converted into a one-row CSV, using its own keys as columns.

How do I convert JSON to CSV in Excel?

Use Data > Get Data > From File > From JSON. In the Power Query Editor, convert the list To Table, click the expand arrows on each column to turn records into columns, then Close & Load and save with File > Save As > CSV UTF-8 (Comma delimited).

Why does my converted CSV have only one row?

Your JSON is probably a single object that wraps the real array, like an API response with a data or results key. Extract that array first, for example with jq '.data' response.json > data.json, and convert the extracted file.

Can I convert a JSON Lines (.jsonl) file to CSV?

Not directly, because JSON Lines puts one separate JSON document on each line. Combine the lines into a single array with jq -s '.' events.jsonl > events.json and convert that file here, or use pandas with read_json(..., lines=True).

How do I put each item of a nested array on its own CSV row?

Use pandas json_normalize with record_path set to the array's key and meta set to the parent fields you want repeated, for example pd.json_normalize(data, record_path='items', meta=['id']). In Excel's Power Query, expanding a column of List values does the same thing.

Last updated October 1, 2026.