Skip to main content

实用工具

JSON 到 CSV 转换器

JSON 到 CSV 转换器

粘贴 JSON 输入
分隔符
🌐

Detailed Guide Coming Soon

We're working on a comprehensive educational guide for the JSON to CSV Converter in your language. The content below is shown in English.

是什么 JSON to CSV Converter?

The JSON to CSV Converter takes a JSON array of objects (the most common API response shape) or a single JSON object and produces delimited CSV (Comma-Separated Values) output with automatic header detection from object keys. Useful for data analysts, marketers, and developers who pull JSON from REST APIs, MongoDB exports, or webhook payloads but need to load the data into Excel, Google Sheets, pandas DataFrames, or SQL tables that expect flat tabular CSV. The conversion handles several edge cases automatically: nested objects are flattened with dot notation (e.g., `address.city` becomes a column), nested arrays are joined with semicolons within a single cell, null/undefined values become empty cells, and inconsistent keys across objects produce a unified column set (missing keys yield blank cells). The default delimiter is comma, but you can switch to semicolon (preferred in European locales where commas serve as decimal separators) or tab (TSV, friendliest for spreadsheets that auto-detect column boundaries). CSV format itself is governed by RFC 4180: each record on its own line, fields separated by delimiter, fields containing the delimiter or newlines must be quoted with double quotes, and embedded quotes are escaped by doubling. The converter applies RFC 4180 quoting automatically so output opens cleanly in any spreadsheet program. UTF-8 encoding preserves international characters. Who this is for: Marketing analysts extracting Mailchimp or HubSpot data, developers debugging webhook payloads, data engineers prepping ETL pipelines, journalists analyzing scraped JSON, and anyone who has stared at a wall of JSON and wished it were a tidy spreadsheet. The tool runs entirely in your browser — no data leaves your device, so you can safely paste sensitive payloads.

PrimeCalcPro provides professional-grade tools trusted by businesses and academics.

公式

f(x)CSV = HeaderRow + (each object → row of values joined by delimiter, RFC 4180 quoted)

变量说明

符号名称单位描述
JJSON InputtextValid JSON array of objects, single object, or nested structure
DDelimitercharComma (default), semicolon, or tab — choose based on locale and downstream tool
CColumn CountcountNumber of unique top-level (or flattened) keys detected
RRow CountcountNumber of records in the array (or 1 for single object)

如何 JSON to CSV Converter

  1. 1Step 1 — Paste your JSON into the input area (array of objects works best)
  2. 2Step 2 — Calculator validates JSON structure and surfaces parse errors with helpful hints
  3. 3Step 3 — Choose delimiter (comma is default; semicolon for European Excel; tab for TSV)
  4. 4Step 4 — Converter auto-detects unique keys across all objects to build column headers
  5. 5Step 5 — Each object becomes a row; missing keys produce empty cells; nested values flatten with dot notation
  6. 6Step 6 — Output appears in a copy-friendly text area with row and column count
  7. 7Step 7 — Copy to clipboard and paste into Excel, Google Sheets, or save as .csv file

例题解析

示例 1Simple array of objects
已知:[{"name":"Alice","age":30},{"name":"Bob","age":25}]
结果:name,age\nAlice,30\nBob,25

Two keys (name, age) become headers; each object becomes a row.

示例 2Nested object flattening
已知:[{"user":"Alice","address":{"city":"NYC","zip":"10001"}}]
结果:user,address.city,address.zip\nAlice,NYC,10001

Nested keys flatten with dot notation so the spreadsheet sees flat columns.

示例 3Inconsistent keys
已知:[{"a":1,"b":2},{"a":3,"c":4}]
结果:a,b,c\n1,2,\n3,,4

Union of all keys becomes column set; missing values are empty cells.

示例 4Array values joined
已知:[{"name":"Alice","tags":["vip","new"]}]
结果:name,tags\nAlice,vip;new

Arrays within objects join with semicolon inside one cell.

实际应用

🏗️

API data import to Excel/Google Sheets

🔬

Webhook payload debugging

📊

MongoDB export prep for analysts

🏥

Marketing platform export (Mailchimp, HubSpot, Salesforce)

⚙️

Quick data inspection before pandas/SQL load

🌍

Journalist data analysis on scraped content

常见问题

Q

What if my JSON contains commas inside string values?

A

The converter automatically applies RFC 4180 quoting — any field containing the delimiter, double quote, or newline gets wrapped in double quotes with internal quotes escaped. Output will parse correctly in any standards-compliant CSV reader.

Q

How are nested arrays handled?

A

Nested arrays are joined with semicolons inside a single cell. For complex nesting (arrays of objects), the converter joins JSON-stringified subobjects so no data is lost. If you need deep flattening, normalize the JSON to one row per leaf record before converting.

Q

Can I convert JSON Lines (NDJSON)?

A

Yes — paste the NDJSON wrapped in brackets to make it a valid array, or paste line-separated objects and the converter will attempt to parse. NDJSON is a common log format and converts cleanly to CSV.

Q

Does the converter handle very large JSON?

A

It runs client-side in your browser, so practical limit depends on your device memory. 10–50 MB JSON typically works well. For multi-GB datasets, use a command-line tool like `jq` or pandas.

Q

Is my data uploaded anywhere?

A

No — everything runs in your browser. Paste sensitive customer data, API tokens, or financial records with confidence. We do not log, store, or transmit your input.

常见错误注意事项

  • !Trailing commas in JSON (invalid per spec; many editors mistakenly allow it)
  • !Single quotes instead of double quotes (JSON requires double quotes for strings)
  • !Unescaped backslashes or newlines inside strings
  • !Forgetting that key order in JSON is not guaranteed across objects — columns reflect first-seen order
  • !Loading European CSV (semicolon-delimited) into US Excel without changing the Region setting
💡

专业提示

Use semicolon delimiter when your data contains commas (European number format, addresses, sentences) to avoid quoting overhead and produce a cleaner-looking CSV. Most European Excel installations expect semicolons by default; US Excel can be configured to use them under Data → Text to Columns or Region settings.

Regional Guides

US / UK
Europe (DE/FR/IT/ES)
Scientific / data engineering
📖难度:初级
提问

对这个计算器有疑问?获取详细解答。

Mathematically verified
Reviewed June 2026
Our methodology

获取每周数学提示

加入 12,000+ 订阅者,每周都会获得计算器提示。

🔒
100% 免费
无需注册
准确
经过验证的公式
即时
即时结果
📱
移动友好
所有设备

设置

隐私条款关于© 2026 PrimeCalcPro