Most bad JSON is not caused by the converter. It is caused by the CSV that went in: a header row with a duplicated name, a row that lost a cell somewhere in the middle, a totals line sitting at the bottom like it belongs. A converter such as the CSV to JSON Converter on Ovatly is deliberately faithful. It reads what you give it, keeps every value exactly as written, and does not stop to ask whether a row looks odd.
That faithfulness moves the quality control to you, before the conversion. This guide is the pre-flight checklist that behaviour makes necessary: five checks, each tied to something the tool will otherwise carry straight through into your JSON.
Contents
- Quick answer
- Check 1: one clean header row, short and unique
- Check 2: consistent column counts on every row
- Check 3: remove totals and summary rows
- Check 4: decide the header question before you paste
- Check 5: blanks that are blank on purpose
- Preparing the file, step by step
- Worked example: one deliberate flaw, padded
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Before converting: give the file a single header row with short, unique names; make every data row match the header length; delete totals, summary and blank separator rows; decide whether your file has a header at all, because that decides whether the output is objects or arrays; and confirm that every empty cell is empty on purpose. Then paste the CSV into the CSV to JSON Converter, convert, and download converted.json.
Check 1: one clean header row, short and unique
With the header option on, header names become the keys of every JSON object. Two properties matter. Short names are easier for the code or person reading the JSON to use, and unique names are non-negotiable: a key holds one value, so two columns named price cannot both survive. One column's data will shadow the other, and the JSON will look valid while quietly missing half a column.
Keep the header to a single row. A title line above the headers, or a two-row grouped header, makes the wrong line the key row. Delete title lines and merge grouped headers into single names before you export.
Check 2: consistent column counts on every row
A ragged row, one with fewer cells than the header, does not fail the conversion. It is padded with empty strings so the resulting object still has every field. The padding hides the real problem: a short row usually means a value shifted or went missing in the sheet, and after conversion it is just a blank that looks intentional.
Fix raggedness in the spreadsheet, where you can see it. Count columns on any row that looks off, and check the usual cause: an unquoted comma inside a product name splitting one cell into two. Quoted fields are read by standard CSV rules, so such a name is safe as long as it is quoted in the file.
Check 3: remove totals and summary rows
The converter has no concept of a summary. Every row after the header becomes a record, including a totals row, an averages row, or a blank line used as a visual separator. A totals row becomes a record whose first field holds the word Total and whose numeric fields hold your sums, indistinguishable in shape from a real entry.
Delete these rows in the sheet before exporting. If you need the totals, keep them in the spreadsheet copy, not in the CSV you convert.
Check 4: decide the header question before you paste
The header checkbox changes the shape of the output. On, and each row becomes an object keyed by header names. Off, and each row becomes a plain array of values, which is the right shape for headerless data such as a matrix of numbers.
The wrong choice fails quietly. Convert a headed file with the option off and the header row becomes a data record. Convert a headerless file with the option on and your first real data row is promoted to keys. Neither produces an error; both produce wrong JSON. Look at your first row and choose deliberately.
Check 5: blanks that are blank on purpose
An empty cell becomes an empty string, and that is often exactly right: a product with no note, a person with no second phone number. Genuine absence deserves a blank.
The check is about unintended blanks: a price missing because the row shifted, a name typed one row down. Scan the columns where a blank would be suspicious, especially fields your reader cannot do without. If a blank cannot be explained, the file is not ready.
Preparing the file, step by step
- Open the spreadsheet and delete any title lines above the header row.
- Rename headers to short, unique names, one row only.
- Sort or scan for ragged rows and fix any row whose length differs from the header, checking for unquoted commas in text fields.
- Delete totals, summary and separator rows.
- Check the columns that must never be blank, and explain every empty cell you find.
- Export as CSV, open the CSV to JSON Converter, set the header option to match your file, and paste or open the CSV.
- Read the output once before downloading converted.json: one record per row you intended, no more, no fewer.
Worked example: one deliberate flaw, padded
Start with the simplest possible file:
name,age
Ana,31
Ben,28
It converts to one object per row, every field present. Now give Ben's row a flaw: his age is missing, so the row is short.
name,age
Ana,31
Ben
The output still succeeds, and Ben's object is padded to completeness:
[
{ "name": "Ana", "age": "31" },
{ "name": "Ben", "age": "" }
]
Nothing complained. That empty string is the whole argument of this guide: if Ben's age mattered, only a check before conversion would have caught the gap. The values are strings throughout, exactly as written, because the converter never guesses types.
Limitations and honest tradeoffs
Preparation improves the input; it cannot add judgement the converter does not have. The tool will not tell you that a price looks wrong, that a date is in the wrong format, or that two records describe the same product. Values are never reformatted or validated, so a consistent file can still contain wrong data, just consistently wrong.
Preparation also has a boundary: if the receiving side needs numbers rather than strings, that conversion is its job. No amount of CSV tidying changes the fact that every value arrives as text.
Common mistakes
- Converting straight from the working spreadsheet. Title lines, grouped headers and totals rows all ride along. Export a cleaned copy instead.
- Trusting a successful conversion as proof of good data. Ragged rows pad, totals convert, duplicates collide: all silently. Success means the file parsed, nothing more.
- Fixing gaps in the JSON afterwards. A padded blank in the output tells you nothing about what the value should have been. Go back to the sheet.
- Guessing the header setting. The wrong choice converts your header into data, or your first data row into keys, with no error either way.
- Renaming headers casually between exports. Downstream readers key on those names; a renamed header is a missing field to them.
FAQs
Why does a duplicate header name cause trouble? With the header option on, header names become the keys of each JSON object, and a key can only hold one value. Two columns with the same name are two claims on one key, so one column's values overwrite or hide the other. Give every column a unique name.
What happens to a row with fewer cells than the header? It is padded with empty strings so the object still has every field. The conversion succeeds, which is exactly why ragged rows are dangerous: the gap becomes a quiet blank instead of an error you would notice.
Should I remove the totals row before converting? Yes. Every row after the header becomes a record, including totals and summary rows. Leave one in and it becomes a fake entry in the JSON, with the total sitting in whichever field the first column feeds.
Are empty cells a problem? No. An empty cell becomes an empty string, which is the honest representation of a value that is genuinely absent. The problem is a gap you did not intend, such as a missing price caused by a shifted row.
Does it matter which delimiter my file uses? Not much. The delimiter is detected automatically, so comma, semicolon and tab separated files are all read. What matters is consistency inside the file, and quoting fields that contain the delimiter, which standard CSV rules handle.
Conclusion
Five minutes of preparation is the difference between JSON you can trust and JSON that merely parsed. Clean the header, level the rows, cut the totals, decide the header setting, and account for every blank, then let the CSV to JSON Converter do the mechanical part. A worked end-to-end example with prices lives in our guide to converting a price list CSV to JSON, and more guides in this series are collected under Data and JSON Tools guides.
References
- RFC 4180, the common format for CSV files: https://www.rfc-editor.org/rfc/rfc4180
- MDN Web Docs, on working with JSON data: https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON