Json To Csv LogoJson To Csv

How to Convert a JSON File to CSV: Uploads, Excel, and the Command Line (2026 Guide)

Your JSON lives in a file, not a clipboard. Here is the complete file-based workflow: validate the file first, then convert it with a free online uploader, Excel Power Query, or a command-line script — plus what to do with huge files, encodings, and common file errors.

Updated: 2026-10-0810 min read

Why converting a JSON file is its own skill

Most conversion tutorials start with JSON already on your clipboard. Real life starts with a file: data.json sitting in your Downloads folder, an API export you saved, a backup from some app. Working from a file adds a layer that clipboard pasting skips — encodings, file sizes, line endings, the shape of what is actually on disk — and every one of them can quietly change your result.

The good news is that files are easier in one respect: they force a repeatable workflow. Once you know the path from .json file to .csv file, it works identically whether the file is 3 KB or 300 MB, whether you do it once or a hundred times. This guide covers that workflow end to end: getting the file, checking it, converting it three different ways, and opening the CSV without mangling it.

Where your JSON file comes from (and why it matters)

JSON files arrive from a handful of places, and knowing which one tells you what to expect inside:

  • API exports and downloads. The "Export" or "Download JSON" button in a dashboard, or a curl call to an API that you saved to disk. These are usually arrays of records — the friendliest shape for CSV — but they can be hundreds of megabytes.
  • App backups. Messaging apps, note apps, and password managers export your data as JSON. These tend to be deeply nested, with objects inside objects, because they were designed for machines, not spreadsheets.
  • Browser devtools. Right-click a network response, "Save as", and you have a .json file. Quick and handy, but double-check you saved the response body and not the HTML wrapper around it.
  • Email attachments and shared drives. A colleague's export that arrives as data.json. Treat these with suspicion until validated — an attachment that passed through three mail servers can pick up encoding damage.

Before touching any converter, open the file in a text editor and look at the first few lines. If you see [ at the top, you have an array of records — ideal. If you see {, you have a single object, possibly with nested structures that will need flattening. Either converts; the second just needs the flattening option turned on.

Step zero: validate the file before you convert

Every converter on this page will refuse a file with a syntax error, and the error message will not always tell you where the problem is. Validate first, convert second — it takes ten seconds and eliminates the most common "why won't this convert" mystery.

The fastest check needs no tools at all if you have Python installed. Run this against your file; it prints nothing on success and exits with an error pointing at the offending line on failure:

Terminal
# Validate data.json (quiet on success, points at the error on failure)
python3 -m json.tool data.json > /dev/null && echo "valid JSON"

The usual culprits are trailing commas, single-quoted strings, and smart quotes pasted in from chat apps or documents — all illegal in JSON. If you would rather click than type, our JSON formatter guide walks through free online validators; prefer one that runs in your browser so the file stays on your machine.

One thing not to worry about: a file that is one enormous line. Minified JSON looks alarming in a text editor, but it is perfectly valid and every method below handles it — you just cannot read it yourself, which is exactly why the validator matters.

Method 1: Upload the file to a free online converter

For a one-off file, uploading beats every other method on speed. A good converter accepts a dropped .json file as well as pasted text — you should never have to open the file and copy its contents by hand, which is how encoding damage and truncated pastes happen.

Here is the workflow, using our free converter as the example:

  • Open the converter and drop your .json file into the upload area (or click to browse). The file is read straight from disk — no copy-paste.
  • Set the options before converting: turn flattening on if your file has nested objects (the converter turns customer.name into a dotted column), pick your delimiter (comma for US/UK Excel, semicolon for most European locales), and keep headers on.
  • Hit convert and download the .csv. The file is generated in your browser tab, so nothing is uploaded to any server.

How do you know a converter really runs in your browser? The offline test: load the page, disconnect your network, and convert. A client-side tool keeps working. This matters because JSON files from work often contain customer emails, API keys, or internal data — you do not want those sitting on somebody else's server. If your file is sensitive, this test is non-negotiable.

The practical limit of this method is file size. Browser tabs comfortably handle files up to a few megabytes; past that, the tab gets sluggish because the whole document lives in memory. If your file is tens of megabytes or more, skip to the command-line method below instead of fighting the tab.

Drop your .json file onto the free converter

Method 2: Open the JSON file in Excel directly

If the spreadsheet is your final destination, you can skip the middleman entirely: modern Excel opens JSON files natively through Power Query. This is the cleanest option when you plan to analyze the data in Excel anyway.

  • In Excel, go to Data, then Get Data, then From File, then From JSON, and select your .json file.
  • Power Query shows the records as a table. If any column contains nested records, click the expand icon in that column's header to spread them into their own columns — the visual equivalent of flattening.
  • Click Close & Load to put the table on a worksheet, then File, Save As, CSV to write the .csv file.

Two honest caveats. First, Google Sheets cannot open JSON files natively — there is no File, Import path for .json. Convert to CSV first with one of the other methods, then use File, Import. Second, watch the delimiter on the way back out: if your locale's Excel expects semicolons, save or re-export with a semicolon delimiter rather than fighting the import wizard later.

Method 3: Convert the file from the command line

When the conversion is one step in a larger job — a daily export, a build script, a data pipeline — a local script beats clicking through any tool. It is also the only comfortable way to handle large files. Here are the two commands data teams actually use, both tested on this machine against a real orders.json file.

Python with pandas is the workhorse: it reads the file, flattens nested objects into dot-notation columns, and writes a CSV with a BOM so Excel detects UTF-8 automatically:

Python
import pandas as pd

# Read the file straight from disk
df = pd.read_json("data.json")

# Flatten nested objects to dot-notation columns (customer.name)
df = pd.json_normalize(df.to_dict("records"))

# utf-8-sig adds a BOM so Excel detects the encoding correctly
df.to_csv("data.csv", index=False, encoding="utf-8-sig")
print(f"wrote data.csv ({len(df)} rows)")

jq is the lighter option when you only need a few fields. This one-liner reads orders.json, pulls three fields per record — including nested ones like customer.name — and prints proper RFC 4180 CSV to stdout. Redirect it to a file and you are done:

A one-line terminal alternative for files

The jq command below was tested on this machine against a real JSON file: two order records with nested customer and pricing objects. It extracted the order ID, the nested customer name, and the nested total into quoted CSV rows:

Terminal
$ jq -r '.[] | [.orderId, .customer.name, .pricing.total] | @csv' orders.json
"ORD-1","Ana",10.5
"ORD-2","Bo",7.25

The @csv filter does the quoting and escaping for you, and the .customer.name syntax reaches straight into nested objects without any flattening step. For quick terminal work on files you already have open, nothing beats it.

Converting many JSON files at once

Exports rarely arrive as one file. A monthly dump might be thirty .json files, and converting them one by one in a browser tab is a slow afternoon. The batch version of the Python script above loops over a folder, converting every file and naming each CSV after its source:

Python
import pandas as pd, glob

# Convert every .json file in exports/ to its own .csv
for path in sorted(glob.glob("exports/*.json")):
    df = pd.json_normalize(pd.read_json(path).to_dict("records"))
    out = path.rsplit(".", 1)[0] + ".csv"
    df.to_csv(out, index=False, encoding="utf-8-sig")
    print(f"{path} -> {out} ({len(df)} rows)")

This was tested on this machine against two sample files: each produced its own CSV with the flattened columns orderId,customer.name,pricing.total and a row count printed per file, so you can spot at a glance if any file came out empty. One caution: the script assumes every file has the same shape. If your folder mixes different exports, convert each shape separately — unioning different key sets into one CSV produces a confusing, sparse grid.

Large JSON files that choke browser tabs

A browser tab holds the entire document in memory, so files in the tens or hundreds of megabytes make tabs freeze or crash. The rule of thumb: a few megabytes is fine in the browser; anything bigger converts locally. Local tools do not have the tab's memory ceiling:

  • jq streams. For simple field projections it never holds the whole file in memory, which is why it stays fast on gigabyte-scale logs.
  • Python with pandas handles hundreds of megabytes on an ordinary laptop — the script above works unchanged.
  • For truly huge files, check whether the export can be split into one JSON object per line (JSON Lines). Line-delimited files process one record at a time and never need the whole document in memory at once.

Whatever the size, validate first: finding one syntax error in a 2 GB file is far easier with python3 -m json.tool (or a streaming validator) than by watching a converter fail after a five-minute upload.

After the CSV lands: open it without mangling it

The conversion can be perfect and the spreadsheet still looks wrong, because opening a CSV is itself a small skill. These are the three fixes that solve nearly every "my CSV looks broken" report:

  • Encoding: if accented characters turn into gibberish, the file was read as ANSI instead of UTF-8. Re-import it and set the file origin to 65001: UTF-8. (The Python script above writes a BOM specifically so Excel detects this on its own.)
  • Delimiter: if everything lands in a single column, your Excel expects semicolons — common in European locales. Re-export with a semicolon delimiter instead of fighting the import.
  • Leading zeros: zip codes and IDs like 07477 lose their zero when a spreadsheet guesses "number". Format the column as text on import, or prefix with an apostrophe.

And keep the original .json file. Conversion reads the file without changing it — the JSON is untouched — and archiving it costs nothing. CSV is a one-way simplification: converting back will not restore data types or un-flatten your columns.

File errors and how to fix them

Files add failure modes that pasted text never has. When a converter rejects your file, run through this list before anything else:

  • Wrong extension. A file saved from Notepad as data.json.txt — or a .json that is actually HTML from a failed download — will not parse. Open the first lines: if you see <html>, you downloaded an error page, not JSON.
  • Encoding damage. Files that passed through email or were saved with the wrong encoding can carry mojibake. Re-save as UTF-8; when in doubt, the validator from step zero will flag what it cannot read.
  • The file is fine but enormous. See the large-files section: this is a tooling problem, not a data problem.
  • Line endings. CRLF versus LF does not affect JSON parsing at all, so if a converter blames line endings, the real problem is elsewhere — usually one of the above.

Ninety percent of "it won't convert my file" reports end at one of these four. The remaining ten percent are genuinely invalid JSON, and the validator points straight at the offending line.

Which file workflow should you pick?

Every method on this page reads the same file and produces the same CSV for the same input — the choice is about convenience, privacy, and scale. Match your situation:

  • One file, a few megabytes or less: drop it onto a free online converter. Fastest by far.
  • Sensitive data in the file: a client-side converter, Excel, or a local script — nothing that uploads first.
  • The spreadsheet is the destination: Excel's From JSON, skipping the converter.
  • Many files or a schedule: the Python batch script, version-controlled and rerunnable.
  • A huge file: local tools only — jq, Python, or line-delimited processing.

And the habit that underlies all of them: validate the file before you convert, keep the original after you convert, and check the encoding when you open the CSV. Do those three and JSON files become the easiest input you have.

Related guides

Frequently asked questions

Can I convert a JSON file to CSV without installing anything?

Yes. Drop the .json file onto a free online converter that runs in your browser — no install, no account — and download the CSV. If Excel is already installed, Data > Get Data > From File > From JSON opens the file natively with nothing extra to install.

Is it safe to upload my JSON file to an online converter?

Only if the conversion happens in your browser. Client-side converters, like this site's, read the file from disk and generate the CSV locally, so the data never leaves your machine. Test any converter by disconnecting your network after the page loads: if it still converts, it is client-side and safe for sensitive files.

Why does Excel put my whole CSV in one column after converting a JSON file?

Your Excel expects a different delimiter — usually semicolons in European locales. Re-export the CSV with a semicolon delimiter instead of fighting the import wizard, or use Data > From Text/CSV and set the delimiter explicitly on import.

How do I convert a very large JSON file to CSV?

Convert it locally, not in a browser tab. jq streams through gigabyte-scale files for simple field projections, and a short Python script with pandas handles hundreds of megabytes on an ordinary laptop. Validate the file first — finding one syntax error in a huge file is much easier before conversion than after a failed attempt.

Can I convert multiple JSON files to CSV at once?

Yes — a short batch script loops over a folder and converts every file, naming each CSV after its source. The Python snippet in this guide does exactly that with pandas, printing a row count per file so you can spot empty results. Convert each distinct data shape separately so different key sets do not merge into one confusing grid.

My JSON file will not convert. What is wrong?

Almost always one of four things: the file is not valid JSON (run python3 -m json.tool to find the error), the "JSON" is actually an HTML error page from a failed download, the file is too large for a browser tab, or the extension lies (data.json.txt). Validate first — it points at the exact problem in seconds.

Does converting change or delete my original JSON file?

No. Every method in this guide reads the file and writes a new CSV — the original .json is untouched. Keep it as your archive: CSV is a one-way simplification, and you cannot restore data types or nested structure by converting the CSV back.

Your JSON file is ready to become a spreadsheet

Drop your .json file onto the free converter and download a clean, spreadsheet-ready CSV in seconds — no sign-up, and your file never leaves your browser.

Convert your JSON file now
All guides