RevealTheme logo

CSV转JSON工具

将CSV数据转换为JSON对象数组。第一行被视为表头。

如何使用本工具

  1. 1

    Paste your CSV — make sure the first row holds the column headers.

  2. 2

    Click Convert. Each following row becomes a JSON object keyed by the header names.

  3. 3

    Copy the JSON array, ready to drop into a JavaScript file, API mock, or seed script.

什么是CSV转JSON工具?

CSV转JSON是JSON转CSV的逆过程。当你从电子表格或数据库的导出中获得数据,并需要在JavaScript应用中使用时,它会很有用。本工具遵循RFC 4180:带引号的字段会被去除引号,双引号会被反转义,引号内的换行符会被保留。

常见使用场景

  • Turn a clean spreadsheet of products, users, or locations into a JSON array to seed a database or mock an API.

  • Convert exported analytics or CRM data into JSON for a quick chart or dashboard prototype.

  • Build test fixtures from a CSV someone handed you, without writing a parser.

  • Migrate config that lives in a spreadsheet into a JSON file your app reads at build time.

  • Sanity-check a CSV's structure — malformed rows become obvious when the object keys stop lining up.

  • Hand front-end developers ready-to-use JSON instead of a raw export they'd have to parse themselves.

常见问题

它使用什么分隔符?
默认使用逗号。TSV(制表符分隔)需要预处理。
数据类型是如何处理的?
所有值都是字符串:JSON拥有带类型的数字,但在没有模式定义的情况下解析CSV是有歧义的。请在你的应用中转换数据类型。

相关工具