Diysb Tools

将 CSV 转换为 JSON

将 CSV 文件转换为 JSON 格式,并可自定义分隔符、引号和输出格式。支持标题、注释和动态类型转换。

CSV 工具

什么是 CSV 到 JSON 转换器?

此工具可将逗号分隔值 (CSV) 文件转换为 JavaScript 对象表示法 (JSON) 数据结构。它支持各种 CSV 格式,并带有可自定义的分隔符、引号和注释符号。转换器可以将第一行视为标题,跳过空行,并自动检测数字和布尔值等数据类型。生成的 JSON 可用于数据迁移、备份或作为其他应用程序的输入。

输入 CSV
输出 JSON
工具选项
输入 CSV 格式
列分隔符(例如,,;\t)
字段引号(例如“)
注释符号(例如 #)
转换选项
将第一行视为列标题
忽略输入 CSV 中的空行
自动转换数字和布尔值
将 CSV 转换为 JSON 示例

Basic CSV to JSON Array

Convert a simple CSV file into a JSON array structure.

name,age,city John,30,New York Alice,25,London
name,age,city John,30,New York Alice,25,London
[ { "name": "John", "age": 30, "city": "New York" }, { "name": "Alice", "age": 25, "city": "London" } ]
[ { "name": "John", "age": 30, "city": "New York" }, { "name": "Alice", "age": 25, "city": "London" } ]
输入 CSV 格式
列分隔符(例如,,;\t)
字段引号(例如“)
注释符号(例如 #)
转换选项
将第一行视为列标题
忽略输入 CSV 中的空行
自动转换数字和布尔值

CSV with Custom Delimiter

Convert a CSV file that uses semicolons as separators.

product;price;quantity Apple;1.99;50 Banana;0.99;100
product;price;quantity Apple;1.99;50 Banana;0.99;100
[ { "product": "Apple", "price": 1.99, "quantity": 50 }, { "product": "Banana", "price": 0.99, "quantity": 100 } ]
[ { "product": "Apple", "price": 1.99, "quantity": 50 }, { "product": "Banana", "price": 0.99, "quantity": 100 } ]
输入 CSV 格式
列分隔符(例如,,;\t)
字段引号(例如“)
注释符号(例如 #)
转换选项
将第一行视为列标题
忽略输入 CSV 中的空行
自动转换数字和布尔值

CSV with Comments and Empty Lines

Process CSV data while handling comments and empty lines.

# Comment id,name,active 1,John,true 2,Jane,false 3,Bob,true
# Comment id,name,active 1,John,true 2,Jane,false 3,Bob,true
[ { "id": 1, "name": "John", "active": true }, { "id": 2, "name": "Jane", "active": false }, { "id": 3, "name": "Bob", "active": true } ]
[ { "id": 1, "name": "John", "active": true }, { "id": 2, "name": "Jane", "active": false }, { "id": 3, "name": "Bob", "active": true } ]
输入 CSV 格式
列分隔符(例如,,;\t)
字段引号(例如“)
注释符号(例如 #)
转换选项
将第一行视为列标题
忽略输入 CSV 中的空行
自动转换数字和布尔值