CSV转JSON

解析 CSV 文本或文件为 JSON 数组。

csv解析
关于「CSV转JSON」

它属于「JSON 工具」分类:JSON 的格式化、结构变换与各种数据格式互转。

  • 完整支持带引号的字段:引号内的<b>逗号与换行</b>会被正确保留,双写的 <code>""</code> 会还原成一个引号。
  • <b>首行为表头</b>时输出对象数组;取消勾选则输出二维数组。
  • <b>自动识别类型</b>会把 <code>123</code>、<code>true</code>、<code>null</code> 转成对应的 JSON 类型。
  • 为避免破坏数据,像 <code>007</code> 这类前导零的编号会保持字符串形式。
  • 文件开头的 BOM 会自动去除,不会污染第一个列名。

完全免费、无需注册;所有处理都在浏览器本地完成,文件不会上传到任何服务器。

相关关键词:CSV转JSON、JSON 工具、csv、解析、在线工具、免费

如何使用「CSV转JSON」
  1. 打开工具:打开「CSV转JSON」页面,无需注册、无需安装任何软件。
  2. 准备输入:准备好要处理的内容或文件:文本可直接粘贴,文件可拖入页面(本工具属于「JSON 工具」)。
  3. 填入内容:把内容粘贴进输入框,或把文件拖入页面;也可以点击「示例」先填入样例数据试一下。
  4. 设置选项并处理:按需调整页面上的选项,然后点击处理 / 转换 / 生成按钮。
  5. 获取结果:处理完全在浏览器本地完成,结果可直接复制或下载,文件不会上传到任何服务器。
常见问题
带逗号的内容会串列吗?
不会。解析器遵循 RFC 4180,只要该字段用双引号包裹,里面的逗号、换行都会被当作普通字符处理。
为什么编号 007 没转成数字?
这是刻意的保护:转成数字会变成 7,丢失前导零。只有能够无损往返的数值才会被转换,其余保持字符串。
支持制表符分隔的 TSV 吗?
支持,把分隔符切换为“制表符”即可,其余解析规则完全一致。
中文出现乱码怎么办?
本工具按 UTF-8 读取文件。如果源文件是 GBK 编码,请先用记事本或 Excel 另存为 UTF-8 格式,或直接把内容复制粘贴到输入框。
CSV to JSON (English)

Parse CSV text or files into a JSON array.

Belongs to “JSON Tools”: Format, transform and convert JSON to and from various data formats.

  • Fully supports quoted fields: commas and newlines inside quotes are preserved, and doubled <code>""</code> becomes a single quote.
  • <b>First row as header</b> yields an array of objects; uncheck to get a 2D array.
  • <b>Auto-detect types</b> converts <code>123</code>, <code>true</code>, <code>null</code> to their JSON types.
  • To avoid data loss, leading-zero codes like <code>007</code> stay as strings.
  • A leading BOM is auto-removed so it won’t taint the first column name.

Free, no sign-up; everything runs locally in your browser and files are never uploaded.

Keywords: CSV to JSON, JSON Tools, csv, parse, online tool, free

How to use it

  1. Open the tool:Open the “CSV to JSON” page — no sign-up and nothing to install.
  2. Prepare the input:Prepare the content or file to process: paste text or drop a file onto the page (this tool belongs to “JSON Tools”).
  3. Provide the input:Paste your content into the input box or drop a file onto the page; you can also click “Sample” to try example data first.
  4. Adjust options and run:Adjust the options if needed, then click the process / convert / generate button.
  5. Get the result:Everything runs locally in your browser; copy or download the result — your files are never uploaded.

FAQ

Will comma content break columns?
No. The parser follows RFC 4180: as long as the field is double-quoted, commas and newlines inside are treated as normal characters.
Why didn’t 007 become a number?
Intentional protection: turning it into a number yields 7 and loses the leading zero. Only losslessly round-trippable values are converted; others stay strings.
Does it support tab-separated TSV?
Yes — switch the delimiter to “Tab”; all other parsing rules are identical.
Chinese shows as garbled?
This tool reads files as UTF-8. If the source is GBK, save it as UTF-8 with Notepad or Excel first, or just paste the content in.

More tools in JSON Tools

  • JSON Formatter/Minifier — Beautify, minify, validate and highlight JSON.
  • Sort JSON Keys — Recursively sort object keys alphabetically to ease diffing.
  • Flatten JSON — Flatten nested structures into a.b.c single-level keys.
  • Unflatten JSON — Restore dotted-path objects into nested structures.
  • JSON to CSV — Convert an array of objects into a downloadable CSV.
  • JSON to Excel — Export an array of objects as an .xlsx workbook.
  • Excel to JSON — Upload an Excel file and convert sheets to JSON.
  • JSON to XML — Convert JSON structures into well-indented XML.
  • XML to JSON — Parse an XML document into an equivalent JSON object.
  • JSON to YAML — Convert JSON into more readable YAML.
  • YAML to JSON — Parse YAML config into standard JSON.
  • JSON to SQL — Generate INSERT statements and CREATE TABLE DDL from arrays.
  • SQL to JSON — Reverse-engineer JSON data from INSERT statements.
  • JSON to Base64 — Convert JSON to and from Base64 with UTF-8 support.
  • JSON ⇄ Cookie — Convert between Cookie strings and JSON key-values.
  • JSON Diff — Recursively compare two JSON documents, marking add/delete/change.

返回崽崽工具箱首页