Skip to content

JSON to CSV Converter (Flattens Nested JSON)

JSON to CSV converter that flattens nested objects, escapes commas and quotes, and downloads an Excel-ready file. Runs locally; nothing uploaded.

By Updated Runs in your browser

JSON CSV Converter guide

Turn a JSON array from an API, database export, or log into a CSV you can open in Excel or Google Sheets. Nested objects become dot-notation columns, and the conversion runs entirely in your browser.

How the conversion works

JSON is a tree; CSV is a grid. Converting between them means deciding how the tree maps onto rows and columns. This tool uses the convention most developers expect: the top-level array is the list of rows, each object in it is one row, and every distinct key across all objects becomes a column.

The header row is built from the union of keys in the order they first appear. If the first record has id, name, and email, and the third record adds phone, phone becomes the fourth column and earlier rows get an empty cell there. Nothing is dropped just because records are inconsistent, which is normal for API data.

Flattening nested JSON

Real JSON is rarely flat. A user record from an API often looks like {"id": 7, "address": {"city": "Austin", "zip": "78701"}}. Without flattening, the address column would hold the raw text {"city":"Austin","zip":"78701"}, which is useless in a spreadsheet.

With Flatten on, the converter walks each object recursively and joins the path with dots, producing columns id, address.city, and address.zip. That is the same convention used by pandas json_normalize and most BI import tools, so the column names will look familiar downstream.

Arrays are the exception. A tags field of ["math", "code"] could mean one column per tag, one row per tag, or a joined string, and the right answer depends on your analysis. The tool keeps arrays as compact JSON in a single cell so no information is lost; split them later in your spreadsheet if you need to.

Worked example

Input: [{"id": 1, "name": "Ada Lovelace", "address": {"city": "London"}, "tags": ["math", "code"]}, {"id": 2, "name": "Grace Hopper", "address": {"city": "Arlington"}, "note": "Said \"hi\""}].

Output header: id,name,address.city,tags,note. Row 1: 1,Ada Lovelace,London,"[""math"",""code""]", followed by an empty note cell. Row 2: 2,Grace Hopper,Arlington, an empty tags cell, then "Said ""hi""". The tags cell and the note cell are quoted because they contain double quotes, and each inner quote is doubled. That is exactly what RFC 4180 requires and what Excel and Google Sheets expect when reading the file back.

Escaping rules that prevent broken files

A CSV cell must be wrapped in double quotes if it contains the delimiter, a double quote, a carriage return, or a line feed. Inside a quoted cell, every double quote is written twice. Rows are separated with CRLF line endings, the RFC 4180 default, which every major spreadsheet reads correctly.

The most common hand-rolled converter bug is forgetting one of those cases. A single street address with a comma, like 123 Main St, Apt 4, then shifts every following column one place to the right. If you have ever opened a CSV and seen data in the wrong columns, that is usually why.

Opening the result in Excel and Google Sheets

The downloaded file starts with a UTF-8 byte order mark. Without it, Excel on Windows guesses the encoding and turns names like José or Zoë into garbage characters. Google Sheets handles UTF-8 either way.

Excel in many European locales uses the comma as a decimal separator and expects semicolons between fields. If your whole file lands in column A, re-export with the semicolon delimiter. Tab-separated output is handy for pasting straight into a spreadsheet grid.

Watch leading zeros. ZIP codes like 02134 and IDs like 007 are strings in JSON, but Excel converts them to numbers on open and drops the zeros. Import through Data > From Text/CSV and set those columns to Text to keep them.

Security note: formula injection and data privacy

If a cell value starts with =, +, -, or @, spreadsheet apps may treat it as a formula. Data scraped from user input can carry a malicious formula this way, a problem known as CSV injection. Review untrusted data before opening it, or prefix risky cells with a single quote in your pipeline.

On privacy: many online converters upload your file to their server. This one parses and writes the CSV inside your browser tab, so customer lists, exports, and logs stay on your machine.

How we calculate: sources

Frequently asked questions

How do I convert JSON to CSV?

Paste a JSON array of objects. Each object becomes a row and each unique key becomes a column. Objects missing a key get an empty cell, so records with different fields still line up.

How are nested objects handled?

With Flatten on, {"address": {"city": "London"}} becomes a column named address.city. Arrays are kept as JSON text in a single cell, since there is no clean way to spread a list across columns.

Are commas and quotes escaped?

Yes, following RFC 4180. Any cell containing the delimiter, a double quote, or a line break is wrapped in double quotes, and inner quotes are doubled: She said "hi" becomes "She said ""hi""".

Will the CSV open correctly in Excel?

Yes. The download includes a UTF-8 byte order mark so Excel shows accented letters and emoji correctly. In countries where Excel expects semicolons, pick the semicolon delimiter.

Can I convert a single JSON object?

Yes. A single object is treated as a one-row table. A bare array of values like [1, 2, 3] becomes one column named value.

Is it safe for customer or production data?

Yes. Parsing and conversion run in your browser tab, and there is no save or share feature. Your data never touches a server, unlike online converters that store uploads.

Is my data uploaded?

Everything runs in your browser. Nothing you enter is uploaded to a server or stored by us.

Why do my ZIP codes lose their leading zero in Excel?

Excel auto-converts 02134 to the number 2134 when opening a CSV. Use Data > From Text/CSV and set the column type to Text, or in Google Sheets use File > Import and turn off Convert text to numbers, dates, and formulas.

Can I convert CSV back to JSON?

Yes. Use the CSV to JSON converter, which reads a header row and turns each following line into an object.