JSON 转 CSV JSON to CSV Converter
将 JSON 数组对象转换为 CSV,便于导入 Excel / Google Sheets 做分析与透视表。
Convert a JSON array of objects into CSV for Excel / Sheets analysis (pivot tables, filtering, etc.).
1. 输入数据 · Input
3. 使用说明 · Notes
-
输入格式要求 · Input format
中文:本工具主要面向“数组 + 对象”这种 JSON:[{"a":1},{"a":2}]。如果你粘贴的是单个对象{"a":1}, 请把它包成数组:[{"a":1}]。
English:This tool expects a JSON array:[{...},{...}]. If you only have a single object, wrap it:[{...}]. -
字段不一致如何处理? · What if keys differ across rows?
中文:不同对象缺失的字段会输出为空(或按你的空值策略输出 null / N/A)。 表头默认是“所有对象 key 的并集”。
English:Missing keys become empty (or “null”/”N/A” depending on your setting). Headers default to the union of all keys. -
扁平化(Flatten)什么时候用? · When should I enable flatten?
中文:当你的数据有嵌套对象(例如 user.profile.name)并且你希望在 Excel 里直接筛选/透视, 建议开启扁平化,它会把嵌套展开为user.profile.name这样的列名。
若你不想展开,也可以关闭扁平化,此时嵌套对象会被 JSON.stringify 成一整段文本写进单元格。
English:Enable flatten when you have nested objects and want to analyze them as separate columns in Excel. If disabled, nested objects are stringified into a single cell. -
数组字段如何写入? · How are arrays exported?
中文:数组默认输出为 JSON 字符串(例如["a","b"]),更完整、更不容易丢信息。 如果你只是简单标签列表,也可以选择“join by comma”,输出a,b。
English:Arrays are exported as JSON strings by default to preserve structure. Optionally, you can join by comma for simple tag-like arrays. -
Excel 打开乱码/列错位怎么办? · Excel issues (garbled text / wrong columns)
中文: 1) 建议选择“UTF-8 BOM”,再下载 CSV 用 Excel 打开;
2) 列错位通常是分隔符冲突(字段里有逗号)导致,改用 TAB 或 |;
3) 最稳的方式是 Excel 的“数据 → 自文本/CSV”导入,可以手动选择编码与分隔符。
English: Use UTF-8 BOM, choose a safer delimiter (TAB/|), or import via Excel “Data → From Text/CSV” to select encoding/delimiter explicitly. -
关于 CSV 转义规则 · CSV escaping rules (important)
中文:当字段包含“分隔符、换行、双引号”时,会自动加引号;字段内部的双引号会变成两个双引号(CSV 标准转义)。
English:If a field contains delimiter/newline/quotes, it will be quoted. Quotes inside fields are escaped by doubling them. -
数据隐私提醒 · Privacy note
中文:本工具完全在浏览器本地运行,不会上传你的 JSON 数据到服务器(除非你自己手动复制到别处)。
English:This runs locally in your browser; your JSON is not uploaded anywhere (unless you paste it elsewhere yourself).
说明:本工具用于数据清洗与导入辅助,输出结果受输入数据结构影响。若你的 JSON 结构非常复杂(深层嵌套、数组套对象、多类型混合),建议先在数据源侧做字段规范化,再导入 Excel。
Note: Output depends on your JSON structure. For very complex nested data, consider normalizing fields at the source before importing into Excel.
