How I turn JSON into CSV for spreadsheets without flattening the wrong thing
· 2 min read
CSV is a table, while JSON can be deeply nested. Conversion works best when the JSON is an array of similar objects.
The JSON to CSV tool is useful because it lets me check the result in a small, controlled place before I use it in a bigger workflow.
The simple idea
CSV is a table, while JSON can be deeply nested. Conversion works best when the JSON is an array of similar objects.
The goal is not to click buttons quickly. The goal is to understand the input, produce the expected output, and notice anything that could be misleading.
Step 1: Check that the JSON is valid
Check that the JSON is valid.
Start with a small example if possible. Small examples make mistakes easier to see.
Step 2: Confirm the main data is an array of records
Confirm the main data is an array of records.
Step 3: Look at the first few objects to understand the columns
Look at the first few objects to understand the columns.
Step 4: Convert and inspect the header row
Convert and inspect the header row.
Step 5: Check how nested objects and arrays were flattened
Check how nested objects and arrays were flattened.
Step 6: Compare row count with the original array length
Compare row count with the original array length.
Step 7: Open the CSV in a spreadsheet only after checking delimiters and quotes
Open the CSV in a spreadsheet only after checking delimiters and quotes.
My checklist
Before I trust the result, I check:
- Check that the JSON is valid.
- Confirm the main data is an array of records.
- Look at the first few objects to understand the columns.
- Convert and inspect the header row.
- Check how nested objects and arrays were flattened.
- Compare row count with the original array length.
- Open the CSV in a spreadsheet only after checking delimiters and quotes.
The tool handles the mechanical part. I still review the result before I publish it, send it, or use it in production.
Comments
Comments are welcome — please read the comment policy first. Powered by giscus and GitHub Discussions.