CSV ⇄ JSON Converter|CSV / JSON 数据转换

CSV ⇄ JSON 转换器 | CSV ⇄ JSON Converter

CSV ⇄ JSON 转换器 CSV ⇄ JSON Converter

将 CSV 表格文本转换为 JSON,或把 JSON 数据还原为 CSV 文件格式,方便数据导入、导出与调试。
Convert CSV table text to JSON, or convert JSON data back to CSV for easy import, export and debugging.

1. 输入与设置 · Input & Settings

支持常见 CSV 格式:使用逗号分隔,支持用双引号包裹含有逗号或换行的单元格;也支持标准 JSON 数组。
Supports common CSV format: comma-separated values with double quotes for cells containing commas or line breaks; also supports standard JSON arrays.

输出区域为只读模式,方便直接复制结果到其他工具或文件中。
Output is read-only so you can safely copy and paste the result into other tools or files.

3. 使用说明 · How It Works
  • CSV ➜ JSON:
    默认把第一行视为表头,生成「对象数组」形式的 JSON,例如 [{"name":"Alice","age":30}]。如果取消“第一行为表头”的勾选,则输出为「二维数组」 形式,例如 [["name","age"],["Alice","30"]]
    When converting CSV to JSON: The first row is treated as header and converted to an array of objects by default. If you uncheck “Use first row as header”, the output becomes a 2D array of rows.
  • JSON ➜ CSV:
    如果 JSON 是「对象数组」(例如从 CSV 生成的 JSON),工具会自动提取所有字段名作为表头行, 并将缺失字段留空;如勾选“对象转 CSV 包含表头”,则会在首行输出字段名。
    若 JSON 是「二维数组」,则直接逐行按顺序输出。单个对象或单个值会自动包装成简易两列/一列结构。
    When converting JSON to CSV: For an array of objects, keys become header row; missing keys are left blank. For a 2D array, rows are written as-is. A single object or single value is wrapped into a simple CSV shape.
  • 格式与兼容性 · Formatting & Compatibility:
    CSV 使用逗号 , 作为分隔符,含有逗号、引号或换行的单元格会自动加双引号,并对内部引号进行转义。
    JSON 可配合“美化 JSON 输出”选项,以缩进格式展示,方便调试和人工阅读。
    CSV uses comma as delimiter and will quote cells containing commas, quotes or line breaks. Pretty JSON output is helpful when debugging or reading manually.
  • 典型应用场景 · Typical Use Cases:
    把 Excel / 表格工具导出的 CSV 转成 JSON,用于前端页面或接口模拟数据;或将接口返回的 JSON 转为 CSV,便于在表格软件中进行分析、透视或筛选。
    Convert CSV exported from Excel or other spreadsheet tools into JSON for front-end pages or mock APIs, or turn JSON responses into CSV for analysis and pivoting in spreadsheet tools.

说明:本工具专为简单通用场景设计,未考虑极端数据量、特殊编码或自定义分隔符等高级需求。如需在生产环境中批量处理数据, 建议配合专业 ETL 工具或脚本语言(如 Python、Node.js)使用。
Note: This tool is designed for common everyday scenarios and does not handle extreme data sizes, exotic encodings or custom delimiters. For production-scale data processing, consider using ETL tools or scripting languages such as Python or Node.js.