Capypix中文

JSON to CSV Converter

Turn API responses, database exports and JSON Lines into a spreadsheet. Nested fields become columns, and the file opens cleanly in Excel. Your data never leaves the browser.

Nested objects
Arrays
Delimiter
For Excel

🔒 Your JSON is converted on your own device. It is never uploaded to any server. Your settings are remembered in this browser.

How to convert JSON to CSV

  1. Paste JSON into the text box, or drop .json, .jsonl or .ndjson files onto the box above — several at a time is fine. Pasted JSON is converted as you type.
  2. Check the preview table. If the JSON holds more than one list, choose the one you want under Rows from. Change Nested objects, Arrays or Delimiter if needed; everything is converted again straight away.
  3. Click Download CSV, or Download Excel for an .xlsx file. Copy CSV puts the text on your clipboard, and with two or more files Download all (ZIP) saves every CSV at once.

How nested JSON becomes columns

A spreadsheet is a flat grid and JSON is not, so every value needs a column to live in. The converter reads all the records before writing anything and builds the header from every key it finds, not just the keys of the first record. A key inside another object becomes a dotted path, so address.city gets a column of its own. Columns appear in the order they are first seen, grouped under their parent: a field that turns up only in a later record still lands next to its siblings instead of at the far right. A record that lacks a field gets an empty cell.

For example, [{"id": 1, "name": "Ana", "address": {"city": "Lisbon"}, "tags": ["vip", "beta"]}, {"id": 2, "name": "Ben", "address": {"city": "Leeds", "zip": "LS1"}}] gives five columns: id, name, address.city, address.zip and tags. Ana’s zip and Ben’s tags are empty, and Ana’s tags read vip; beta.

Lists of plain values are joined with a semicolon and a space. A list that contains objects, such as the line items of an order, is kept as compact JSON in a single cell; spreading it out would create items.0.sku, items.1.sku… columns that differ from row to row. To keep the original structure, set Nested objects to JSON text: the top-level keys stay as columns and each nested object is written as JSON in its cell. Set Arrays to JSON text as well and lists of plain values are kept as JSON too, instead of being joined.

Opening the CSV in Excel without garbled characters

A CSV file is plain text with nothing inside that says which character encoding it uses. When you double-click one, Excel for Windows often falls back to the computer’s older regional encoding unless the file starts with a byte order mark (BOM), and UTF-8 text such as café comes out as café. The UTF-8 BOM option, on by default, writes the three bytes EF BB BF at the start of the file so Excel reads it as UTF-8. Copied text never includes the BOM.

Turn the BOM off when the CSV is meant for a program rather than a person, because some import scripts read it as part of the first column name. For a CSV someone else made without a BOM, use Data › From Text/CSV in Excel and set File Origin to 65001: Unicode (UTF-8). Or skip the question and download the .xlsx, where text is stored as Unicode and there is no encoding to guess.

JSON shapes that convert

You don’t have to tell the converter how your JSON is laid out. It looks at the structure, picks a sensible starting point and shows the result in the preview straight away. These are the layouts it recognises:

Your JSONLooks likeWhat you get
Array of objects[{"id": 1}, {"id": 2}]One row per object; the header lists every key found in any record
Object wrapping a list{"meta": {…}, "data": […]}Rows from the list; another list can be chosen under Rows from
Object keyed by ID{"u1": {"name": "Ana"}, "u2": {…}}One row per key, with the key in a key column
JSON Lines (.jsonl, .ndjson)One {…} per lineOne row per line; blank lines are skipped
Array of arrays[["id", "name"], [1, "Ana"]]Written row by row exactly as it is; no header is added
Single object{"name": "Ana", "address": {…}}One row, or one row per field
Array of plain values[3, 5, 8]A single value column

Pasted text or a file that fails to parse as one JSON document is tried as JSON Lines when its first non-empty line parses on its own as an object or array and there are at least two non-empty lines; Windows line endings and blank lines are fine. Files named .jsonl or .ndjson are read line by line first and, if that fails, as ordinary JSON, which helps when a pretty-printed array was saved with the wrong extension.

Choosing where the rows come from

API responses rarely start with the records themselves. They wrap them: {"meta": {"page": 1}, "data": […], "links": […]}. The converter looks a few levels into the object for lists of records, and for objects whose values are records keyed by an ID. Whenever the top level is an object, a Rows from menu appears above the preview with every candidate and its row count.

The default is the largest list stored under a familiar name — data, items, results, records, rows, hits, features and a few more — and otherwise the candidate with the most rows. A document that is itself keyed by IDs gets one row per key. The menu also offers:

Long numbers, leading zeros and dates

Excel stores numbers with 15 significant digits, and when it opens a CSV it converts anything that looks like a number. A 19-digit ID such as 1453928392010284033 is kept as 1453928392010280000 and shown in scientific notation, like 1.45E+18; once the file is saved again, the lost digits are gone. Leading zeros disappear as well (the ZIP code 02134 becomes 2134), and a phone number written as +14155550123 loses its plus sign.

The Keep long numbers & leading zeros option, on by default, protects three kinds of values in the CSV: whole numbers with 16 or more digits, digit strings that start with 0, and digit strings that start with +. Each is written as ="02134", a tiny formula that Excel displays as the original text. A note under the preview says how many cells were wrapped, and a red warning appears if the option is off and such values exist.

Value in the JSONPlain CSV opened in ExcelCSV with the option onExcel (.xlsx) download
1453928392010284033Scientific notation; the last digits become 01453928392010284033Text cell, every digit kept
"02134"213402134Text cell, 02134
"+14155550123"A number without the ++14155550123Text cell, unchanged
"1-2"Turned into a dateStill turned into a dateText cell, unchanged

Two caveats. The ="…" trick is meant for Excel: a database import, a script or another spreadsheet app may read the formula text literally, so switch the option off when the CSV is going anywhere else. And the option does not touch date-like text such as 1-2, 3/4 or SEPT2. Excel’s habit of turning those into dates is the reason the HUGO Gene Nomenclature Committee renamed genes such as SEPT1 and MARCH1 (now SEPTIN1 and MARCHF1) in 2020. If your data has values like these, download the .xlsx: every JSON string is stored there as a text cell, and Excel leaves text cells alone.

Numbers with 12 to 15 digits, such as millisecond timestamps, keep their value, but Excel’s General format shows numbers of 12 or more digits in scientific notation. Select the column and apply the Number format with 0 decimal places to see every digit.

Comma, semicolon or tab

When Excel opens a CSV by double-click, it splits the columns with the list separator from the computer’s regional settings. That separator is a comma in the United States, the UK and China, but a semicolon in much of continental Europe, where the comma is the decimal mark. If the whole file lands in column A, choose Semicolon and download again. The decimal point stays a dot either way, so in those regions a value like 12.5 may still be read as text or as a date; the .xlsx avoids that, because numbers are stored as numbers and shown in the reader’s own format.

Tab produces a .tsv file and turns the buttons into Download TSV and Copy TSV. Tab-separated text is the easiest thing to paste: put it into Excel or Google Sheets and it spreads across columns by itself, with no import dialog.

What the CSV file contains

Size limits and speed

When the JSON won’t parse

Invalid input gets a message with the line and column of the first problem, a copy of that line and a ^ pointing at the spot. These are the usual causes:

Other ways to convert JSON to CSV

For a one-off file, or on a computer where you can’t install anything, the converter at the top of this page is quicker: paste, check the preview, download.

Frequently asked questions

Can I convert JSON data to CSV?

Yes, as long as the JSON is, or contains, a list of records. An array of objects gives one row per object, an object that wraps a list (under data, items or results, for example) uses that list, and a JSON Lines file gives one row per line. Even a single object converts: into one row, or into a two-column table with one row per field.

Can you convert a JSON file to Excel?

Yes. Once the preview looks right, click Download Excel. You get an .xlsx file with one sheet named after your file, a bold header row that stays in view while you scroll, filter buttons on every column and column widths set from the content. Text, numbers and true/false values keep their types, and null becomes an empty cell.

Is my JSON uploaded anywhere?

No. The conversion runs in JavaScript on your own device, in a background worker inside the browser. What you paste or drop is never sent to a server, and the CSV and Excel files are created locally. The only thing the page remembers is your choice of options, stored in this browser.

How do I convert JSON to CSV in Excel?

In Excel for Microsoft 365 on Windows, choose Data › Get Data › From File › From JSON and pick the file. Power Query opens it as a list: click To Table, then the expand button in the column header, repeat for each nested level, and load the result. It is worth setting up for regular imports; for a single file, the converter on this page is faster.

How do I convert JSON to CSV in Python?

With pandas: load the data with json.load, flatten it with pandas.json_normalize(data), then save it with .to_csv("out.csv", index=False, encoding="utf-8-sig"). json_normalize turns nested keys into dotted column names, and utf-8-sig adds the BOM that Excel on Windows needs. For JSON Lines, parse each line with json.loads and pass the resulting list to json_normalize.

Why use JSON instead of CSV?

JSON can nest objects and lists, and it tells numbers, text, true/false and null apart. CSV is a flat grid of text with no types, which is exactly why every spreadsheet can open it. Apps and APIs use JSON to move structured data around; people turn it into CSV when they want to sort, filter or share it as a table.

Why does my CSV show strange characters in Excel?

Excel did not recognise the file as UTF-8. Download it again with the UTF-8 BOM option ticked, open it through Data › From Text/CSV with File Origin set to 65001: Unicode (UTF-8), or download the .xlsx, which has no encoding problem.

Why do my long IDs turn into numbers like 1.45E+18 in Excel?

Excel keeps only 15 significant digits, so longer IDs lose their last digits and are shown in scientific notation. Keep the option “Keep long numbers & leading zeros” ticked, or download the .xlsx, where those numbers are stored as text. A file that Excel has already saved cannot be repaired; convert the original JSON again.

What happens to arrays inside each record?

Lists of plain values become one cell joined with “; ”. Lists that contain objects or other lists are written as JSON text in one cell. A record is never split across several rows. If the list sits in a single object, such as one order, you can choose it under Rows from and get one row per item.

Can I convert several JSON files at once?

Yes. Drop or choose as many as you like. Each file gets its own row in the list showing its row and column count, with its own CSV and Excel links; click a row to preview it. When two or more have converted, Download all (ZIP) saves all the CSV files in one archive.

Does it work with JSON Lines and NDJSON?

Yes. Files ending in .jsonl or .ndjson are read one line at a time, and pasted text with one object per line is recognised automatically. Each line becomes a row, and the summary above the preview says JSON Lines. If a line is broken, the message names that line and the column.

More free tools