JSON 转 CSV 转换器
将 JSON 数组转换为 CSV 格式以用于电子表格。嵌套对象使用点表示法展平。
About JSON to CSV Conversion
- Input should be a JSON array of objects
- Nested objects are flattened using dot notation (address.city)
- Arrays are JSON-stringified in the output
- Values containing delimiters or quotes are properly escaped
JSON to CSV - 技术详情
Converting JSON to CSV is useful for exporting API data to spreadsheets, generating reports, or data analysis. Nested objects are flattened using dot notation (e.g., address.city).
命令行替代方案
# Using jq to convert JSON to CSV\njq -r '(.[0] | keys_unsorted) as $keys | $keys, map([.[ $keys[] ]])[] | @csv' data.json\n\n# Or use json2csv npm package\nnpx json2csv -i data.json