跳到主要内容

CSV 转 JSON

把 CSV 表格转换成 JSON 数组,支持自定义分隔符与表头设置。

Ctrl / ⌘ + Enter 快速执行当前操作

输入 CSV

0 行

结果输出

请输入 CSV 内容
本工具所有运算在本地浏览器完成,你的文件、文本不会上传到服务器

工具介绍

CSV 转 JSON 会把表格首行作为字段名,逐行生成对象数组,适合把 Excel 导出的数据交给接口或前端页面;JSON 转 CSV 则把对象数组还原成带表头的表格,方便继续在 Excel 里编辑。 CSV to JSON treats the first row as field names and emits an array of objects row by row — handy for feeding an Excel export into an API or a front-end page. The reverse turns an array of objects back into a headed table you can keep editing in Excel.

解析时会处理引号包裹的逗号、换行和转义双引号,字段里出现逗号也不会让整行错位。 Quoted commas, line breaks and escaped double quotes are handled during parsing, so a comma inside a field will not shift the whole row.

  • CSV → JSON 与 JSON → CSVCSV → JSON and JSON → CSV
  • 首行作为字段名开关First-row-as-header toggle
  • 兼容引号、逗号与换行Quotes, commas and line breaks
  • 结果复制与下载Copy or download the result

使用说明

  1. 在左侧粘贴 CSV 文本或 JSON 数组。Paste CSV text or a JSON array into the left editor.
  2. 选择转换方向:CSV 转 JSON,或 JSON 转 CSV。Pick a direction: CSV to JSON, or JSON to CSV.
  3. CSV 转 JSON 时,可按需勾选“首行作为字段名”。For CSV to JSON, tick “first row as field names” when needed.
  4. 复制结果或下载文件,直接拿去用。Copy the result or download the file.

常见问题

只支持逗号分隔吗?Only comma-separated files?
目前按逗号解析。如果表格用分号或制表符分隔,建议先在 Excel 里另存为逗号分隔的 CSV。Parsing uses commas. If your sheet uses semicolons or tabs, save it as comma-separated CSV from Excel first.
字段里有逗号和换行怎么办?What if a field contains commas or newlines?
用双引号把字段包起来即可,解析时会当作同一个字段的内容。Wrap it in double quotes — it is then read as one field.
中文会乱码吗?Will Chinese characters break?
不会。页面按 UTF-8 处理,导出的文件同样是 UTF-8 编码。No. The page and exported files use UTF-8.
广告位

此处为广告位,可放置你的推广素材

支持图片、文字或 HTML 代码,替换本区块内容即可投放

浏览其他分类