跳到工具
ViewCSV
无需上传文件

CSV 转 JSONL

orders.csv· 示例数据15 行 · 8 列
值类型
按列识别,且只有整列的值都符合时才转换,因此带前导零的编号和大于 9,007,199,254,740,991 的整数(如 18 位身份证号)会保持为文本。
名为 user.name 和 user.email 的列会合并成一个“user”对象,包含“name”和“email”。
{"order_id":"001041","customer":"磊 黄","city":"北京","product":"Coffee beans 1kg","quantity":"7","unit_price":"139.12","order_date":"2026-01-27","status":"pending"}
{"order_id":"001042","customer":"杰 徐","city":"北京","product":"Coffee beans 1kg","quantity":"2","unit_price":"132.10","order_date":"2026-02-14","status":"shipped"}
{"order_id":"001043","customer":"伟 孙","city":"上海","product":"Notebook A5","quantity":"7","unit_price":"129.75","order_date":"2026-03-22","status":"pending"}
{"order_id":"001044","customer":"敏 杨","city":"上海","product":"Chair, ergonomic","quantity":"1","unit_price":"122.25","order_date":"2026-04-25","status":"paid"}
{"order_id":"001045","customer":"静 王","city":"成都","product":"Coffee beans 1kg","quantity":"9","unit_price":"","order_date":"2026-05-15","status":"refunded"}
{"order_id":"001046","customer":"伟 黄","city":"北京","product":"Desk lamp","quantity":"8","unit_price":"104.23","order_date":"2026-06-06","status":"refunded"}
{"order_id":"001047","customer":" 伟 吴 ","city":"成都","product":"USB-C cable","quantity":"5","unit_price":"225.65","order_date":"2026-07-08","status":"refunded"}
{"order_id":"001048","customer":"杰 李","city":"南京","product":"Coffee beans 1kg","quantity":"7","unit_price":"74.98","order_date":"2026-08-11","status":"refunded"}
{"order_id":"001049","customer":"磊 王","city":"南京","product":"Monitor 27\"","quantity":"9","unit_price":"223.84","order_date":"2026-09-22","status":"pending"}
{"order_id":"001050","customer":"艳 吴","city":"南京","product":"Desk lamp","quantity":"3","unit_price":"91.94","order_date":"2026-01-02","status":"shipped"}
{"order_id":"001051","customer":"娜 刘","city":"深圳","product":"Monitor 27\"","quantity":"2","unit_price":"216.98","order_date":"2026-02-18","status":"pending"}
{"order_id":"001052","customer":"磊 刘","city":"上海","product":"Chair, ergonomic","quantity":"8","unit_price":"136.30","order_date":"2026-03-22","status":"pending"}
{"order_id":"001053","customer":"静 张","city":"北京","product":"Desk lamp","quantity":"4","unit_price":"238.82","order_date":"2026-04-25","status":"pending"}
{"order_id":"001054","customer":"艳 陈","city":"南京","product":"USB-C cable","quantity":"4","unit_price":"95.92","order_date":"2026-05-21","status":"paid"}
{"order_id":"001043","customer":"伟 孙","city":"上海","product":"Notebook A5","quantity":"7","unit_price":"129.75","order_date":"2026-03-22","status":"pending"}

15 行 · 1 个文件

将 CSV、TSV 或粘贴的表格转换成 .jsonl 文件,每条数据行对应一个 JSON 对象,首行作为字段名。此页固定输出 JSON Lines,不添加外层数组,每个对象独占一个物理行。

从表格生成 JSONL 文件

  1. 打开 .csv、.tsv 或 .txt 文件,拖到工具上,或粘贴数据。分隔符以及 UTF-8、UTF-16 的字节顺序标记(BOM)会自动识别;如需其他分隔符,或 Windows-1252、Shift_JIS、GB18030 等旧编码,请在 导入设置 中选择。
  2. 选择全部保留为字符串,或仅检测可安全转换的数字和布尔值列。设置空单元格写法,以及点号字段名是否嵌套;预览显示前 200 条输出记录。
  3. 下载 JSONL,也可在支持时复制结果。处理多个文件时使用批量按钮,各文件独立转换,多份结果打包为 ZIP。

单元格换行不会变成额外记录

输出使用无 BOM 的 UTF-8,每个对象后写入 LF 换行。CSV 单元格中的换行会编码为 JSON 字符串转义,不会意外拆出新的 JSONL 记录,也不会插入空白记录行。

决定字段类型、空值和嵌套方式

所有值都保留为文本每个单元格都变成 JSON 字符串,与文件中的写法完全相同。这是默认选项。
识别数字和 true/false只有当某列所有非空值都是能无损转换的普通数字时,该列才会变成 JSON 数字:没有前导零、有效数字不超过 15 位、不使用逗号小数。true/false 列会变成布尔值。日期仍为字符串。
空单元格写成 ""、null,或在该对象中省略这个键。
把带点号的列名转为嵌套对象user.name 和 user.email 会变成 {"user": {"name": …, "email": …}}。如果某个名称既是值又是父级(user 和 user.name),这些列保持平铺,工具会给出提示。

文件大小、分块转换与隐私

交互式输入上限为 25 MiB、100,000 条数据行、250 列及 200 万个单元格。更大的文件使用分块转换,单个输出上限为 4 GiB。转换在当前标签页完成,原文件不上传。

合成示例:多行备注仍属于同一条记录

这份虚构 CSV 包含前导零编号、20 位标识符和多行备注。按默认字符串设置,两条 CSV 数据行生成两条 JSONL 记录;输出中的反斜杠 n 表示字符串转义。

CSV
id,note
00123,"first
second"
12345678901234567890,"Cable, USB"
下载的 JSONL
{"id":"00123","note":"first\nsecond"}
{"id":"12345678901234567890","note":"Cable, USB"}

常见问题

本工具输出逐行 JSON 对象,不带数组外壳。导入前仍应核对接收系统所需的字段名和数据类型。

标准与参考资料