为什么要转成 JSONWhy Convert to JSON

JSON(JavaScript Object Notation)是 Web API、前端应用和 NoSQL 数据库最常用的数据交换格式。相比 CSV,JSON 能表达嵌套对象、数组和层次结构,例如一条订单里包含多个商品。当你要把表格数据喂给接口或前端时,通常需要先把 CSV 转成 JSON。

JSON (JavaScript Object Notation) is the most common data format for web APIs, front-end apps and NoSQL databases. Unlike CSV, JSON can express nested objects, arrays and hierarchies — e.g. one order containing multiple items. When you feed tabular data to an API or front end, you usually convert CSV to JSON first.

最常见的两种结构The Two Most Common Shapes

1. 对象数组(一行一条)1. Array of objects (one row each)

每一行变成一个对象,表头作为键名。这是最通用的形式:

Each row becomes an object with header names as keys. The most universal form:

[{ "姓名": "张三", "城市": "北京" }, { "姓名": "李四", "城市": "上海" }]

2. 嵌套分组(按某列归类)2. Nested grouping (by a column)

如果一列表示"分组键"(如部门),可以把同组多行收进一个数组,形成树状结构,更贴近真实业务模型。

If a column is a "group key" (e.g. department), you can fold matching rows into an array, producing a tree that matches real business models.

提示:嵌套分组能显著减少冗余,但会增加解析复杂度。如果只是给接口传参,对象数组通常就够了。关于字段与编码基础,可先看 什么是 CSV 文件。
Tip: Nested grouping cuts redundancy but adds parsing complexity. For a simple API payload, an array of objects is usually enough. For the field/encoding basics, see What Is a CSV File.

在线转换的步骤Steps to Convert Online

  1. 打开 365Lab CSV 工具箱 的转换功能,拖入你的 CSV。
  2. 选择目标格式为「JSON」。
  3. 如需嵌套,指定分组列与子对象字段。
  4. 确认编码(中文建议 UTF-8),点击转换并下载。
  1. Open the 365Lab CSV Toolkit converter and drop in your CSV.
  2. Pick "JSON" as the target format.
  3. For nesting, set the group column and child fields.
  4. Confirm encoding (UTF-8 for Chinese) and convert, then download.

三个容易踩的坑Three Common Pitfalls

  • 数字被当成字符串:纯文本 CSV 里的 "123" 转 JSON 后仍是字符串,必要时需显式转数字。
  • 中文乱码:务必使用 UTF-8 编码,否则接口收到的是乱码(见 CSV 乱码修复)。
  • 超大文件:百万行直接转 JSON 会占用大量内存,建议分页或先 做分块处理。
  • Numbers become strings: "123" in plain-text CSV stays a string in JSON; cast to number when needed.
  • Garbled Chinese: Always use UTF-8, or the API receives gibberish (see garbled-text fix).
  • Huge files: Converting millions of rows to JSON at once eats memory — paginate or chunk first.

想马上试试?打开在线工具,拖入 CSV 即可预览 JSON 结果,全程本地处理、不上传服务器。

Want to try now? Open the toolkit, drop in your CSV to preview the JSON — everything runs locally.

打开 CSV 转换工具 →Open the CSV Converter →