Waiting for input...
Input JSON (Array format)

Example data loaded — edit or paste your own JSON below.

Output CSV

Tip: Input should be a JSON array, e.g. [{"name":"John","age":30}, ...]

Common Use Cases

Export to Excel

Convert JSON arrays to CSV for spreadsheets

Data migration

Transform JSON data for databases

Generate reports

Create tabular data from JSON records

Common Use Cases

Export to Excel

Convert JSON arrays to CSV for spreadsheets

Data migration

Transform JSON data for databases

Generate reports

Create tabular data from JSON records

What are JSON and CSV formats?

JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate.

CSV (Comma-Separated Values) is a simple tabular data format with values separated by commas. CSV files can be opened and edited in Excel, Google Sheets, and other spreadsheet applications.

How to convert JSON array to CSV?

Using this tool, just three steps:

  1. Paste your JSON array into the left input box
  2. Choose delimiter and options
  3. Click "Convert to CSV" button

Supports downloading as .csv file for direct Excel import.

How are nested JSON objects handled?

When "Flatten Nested Objects" is checked, nested objects are flattened with dot notation. For example:

{"name":"John","address":{"city":"NYC"}}

converts to: name,address.city

The Technical Principles of JSON-to-CSV Conversion

将 JSON 数据转换为 CSV 格式的本质挑战在于"数据模型的降维":JSON 支持任意深度的嵌套结构、混合类型数组、稀疏字段等复杂数据模型,而 CSV 本质上是一个二维表格,每一列必须是标量值。因此,一个合格的 JSON-to-CSV 转换器需要处理三个核心问题。首先是"展平"(Flattening):将嵌套对象展开为扁平键,例如 {"user":{"name":"Alice","address":{"city":"NY"}}} 展平为列名 user_nameuser_address_city。其次是"数组处理":当 JSON 数组中的每个元素是对象时,将它们映射为表格行是最直接的;但当对象中包含嵌套数组时,必须决定是展开为多行还是序列化为 JSON 字符串保留在单个单元格中。第三是"空值填充":JSON 对象之间的字段可能不一致,工具需要智能推断完整的列集合,并对缺失字段填充空字符串。

典型使用场景与对比

场景一:NoSQL 数据库导出分析。MongoDB 的 mongoexport 命令默认输出 JSON Lines 格式。将这些数据导入本工具,您可以直接转换为 Excel 可打开的 CSV,省去编写 Python 脚本的时间。相比使用 mongoimport + Tableau 的方案,本工具的处理链路更短,适合快速探索性分析。

场景二:API 响应数据交付给业务团队。开发团队通过 REST API 获取的 JSON 数据通常需要分享给不熟悉编程的市场或运营团队。使用本工具转换为 CSV 后直接导入 Google Sheets 或 Excel,业务团队可以用熟悉的透视表工具进行二次分析。相比在线 JSON-to-CSV 转换服务(如 ConvertCSV),本工具无需上传数据,在处理包含客户信息的敏感数据时具有明显的隐私优势。

场景三:数据管道中的格式标准化。在 ETL 数据管道中,上游系统可能输出 JSON,下游数据分析平台(如 Metabase、Redash)要求 CSV 格式。本工具可以作为开发阶段的快速验证工具,在编写正式的 Spark/Flink 作业之前,快速检查数据转换结果的正确性。

Practical Tips与进阶操作

技巧一:在转换前先用 JSON Formatter 验证数据完整性。一个缺失的闭合括号可能导致整个文件解析失败,浪费排查时间。技巧二:对于包含 Unicode 字符的 JSON,转换后的 CSV 默认使用 UTF-8 编码。如果用 Excel 打开出现中文乱码,可以在 Excel 的"数据 → 从文本/CSV"导入向导中手动选择 UTF-8 编码。技巧三:当 JSON 数组元素结构不一致时(例如有些对象有 "discount" 字段、有些没有),转换器会自动补齐缺失列,这可能导致 CSV 中出现大量空单元格。建议先用 JQ 或 JSON Path 预处理过滤出结构一致的数据子集。技巧四:对于超大 JSON 文件(超过 100MB),建议使用 jq 命令行工具进行流式转换:cat large.json | jq -r '.[] | [.field1, .field2] | @csv' > output.csv。本工具适合 50MB 以下文件的快速交互式转换。

Frequently Asked Questions

Q: 嵌套数组会怎么处理?
A: 嵌套在对象中的子数组会被序列化为 JSON 字符串存入单个单元格(例如 ["a","b","c"])。如果需要将子数组展开为多行(类似 SQL 的 UNNEST),这超出了 CSV 的二维表能力,建议使用专门的 ETL 工具。

Q: 日期时间字段会如何转换?
A: JSON 中的日期通常以 ISO 8601 字符串存储(如 "2026-05-24T14:30:00Z"),转换时原样保留为字符串。如果需要在 Excel 中进行日期计算,导入后使用 =DATEVALUE() 函数转换。

Q: 与在线转换服务相比有什么优势?
A: 核心优势是隐私性和便捷性。在线服务需要将数据上传到第三方服务器,这对包含 PII(个人身份信息)的数据构成合规风险。本工具全程在浏览器中运行,无需网络传输,也无需注册账号或订阅付费计划。

隐私与安全保证

您的数据不会离开浏览器。所有 JSON 解析和 CSV 生成操作完全在客户端的 JavaScript 引擎中完成。您可以安全地处理包含客户订单信息、财务数据、个人身份信息的 JSON 文件,无需担忧数据泄露风险。本工具不设后端服务器,因此根本不存在数据被存储或拦截的可能。

Input JSON:

[ {"name": "John", "age": 30, "city": "New York"}, {"name": "Jane", "age": 25, "city": "Los Angeles"}, {"name": "Bob", "age": 35, "city": "Chicago"} ]

Output CSV:

name,age,city John,30,New York Jane,25,Los Angeles Bob,35,Chicago

JSON to CSV: Complete Guide

When to Convert JSON to CSV

JSON to CSV conversion is useful when you need to:

  • Import API data into Excel or Google Sheets
  • Analyze JSON data in data visualization tools
  • Share structured data with non-technical users
  • Create backups of configuration data

How to Use This Tool

  1. Paste JSON array into the input (must be array of objects)
  2. Click Convert to generate CSV
  3. Download as .csv file or copy to clipboard

Supported JSON Structure

Valid JSON (array of objects):
[{"name":"John","age":30},{"name":"Jane","age":25}]
Invalid JSON (nested objects need flattening):
{"user":{"name":"John"}}

Related Tools

JSON Formatter JSON Compare
class="related-tools-section">

Related Tools

How to Use This JSON to CSV Converter: Convert JSON to CSV Format Online

This free JSON to CSV converter makes it simple to convert JSON files to CSV spreadsheets that open directly in Excel, Google Sheets, or any data analysis tool. Whether you're exporting API data for reporting, preparing datasets for machine learning, or sharing structured data with non-technical colleagues, this online JSON to CSV conversion tool handles nested objects and arrays gracefully.

How to Convert JSON to CSV Step by Step

  1. Paste your JSON array into the input editor. The tool expects an array of objects, e.g., [{"name":"John","age":30}, ...].
  2. Choose your preferred delimiter: comma (,), semicolon (;), or tab.
  3. Toggle the header row option to include or exclude column names in the output.
  4. Click Convert to CSV to generate the table and download or copy the result.

JSON to CSV Conversion Example

// Input JSON
[{"name":"Alice","email":"[email protected]","role":"admin"},
 {"name":"Bob","email":"[email protected]","role":"user"}]

// Output CSV
name,email,role
Alice,[email protected],admin
Bob,[email protected],user

This free online JSON to CSV converter processes everything locally in your browser. For developers and data analysts who regularly need to transform JSON API responses into spreadsheet-friendly formats, this JSON to CSV guide will help streamline your data pipeline.