You export some JSON, convert it to CSV, open the file, and the table looks wrong. A column is empty for nearly every row. Headers have dots in them. Rows look shifted, as if values landed under the wrong headings. The usual conclusion is that the converter mangled the file.
Most of the time it did not. A CSV is a flat grid, and JSON rarely is, so converting between them forces decisions that surprise anyone expecting a one-to-one copy. This guide walks through the four assumptions that make a correct conversion look broken, using the free JSON to CSV Converter on Ovatly.
Contents
- Quick answer
- Mistake 1: assuming every record has the same keys
- Mistake 2: expecting nested objects to stay nested
- Mistake 3: feeding a list of numbers or a mixed array
- Mistake 4: expecting values to be reformatted
- How to convert JSON to CSV, step by step
- Worked example: two records, three columns, one blank
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
- References
Quick answer
Most "misaligned" JSON to CSV results come from one rule: the columns are the union of every key in every record, in first-appearance order. A key that exists in only one record still gets a column, and the other rows stay blank under it: that blank looks like shifting, but it is the honest table. Nested objects flatten into dot-style columns such as address.city. Scalars and mixed arrays are rejected with an explanation because they have no columns. Values are written exactly as they appear, never reformatted. Convert with the JSON to CSV Converter, then read the output with those four rules in mind before deciding anything is lost.
Mistake 1: assuming every record has the same keys
JSON arrays of objects rarely keep a strict shape. One record has an age field, the next does not. A later record adds a discount code none of the earlier ones mention. Nothing in JSON requires the records to match.
A CSV table has exactly one header row, and every row must fit under it. The converter resolves the mismatch by taking the union: every key from every record becomes a column, ordered by first appearance. If a key shows up for the first time in the ninth record, it still becomes a column, and records one to eight get a blank in it.
That blank is where the "misalignment" panic starts. The row has not shifted. Its values are under the correct headers; it simply never had a value for that column. Deleting the sparse column is fine if you do not need that field, but read it first: it tells you exactly which records carry that field and which do not, which is evidence about your data, not a defect in the file.
Mistake 2: expecting nested objects to stay nested
A record like an address is an object inside an object: a city, a street, a postcode grouped together. A spreadsheet cell cannot hold a group, so something has to give.
What gives is the header. Nested objects are flattened dot-style, so the city inside the address becomes a column named address.city. Read the dot as a path: it tells you where the value lived in the original structure.
Two related cases catch people out. A simple array, such as a list of tags, is joined into one cell with "; " between the items. An array of objects cannot be flattened that neatly, so it is written as JSON text inside the cell, preserved rather than silently dropped. If you see raw JSON in a cell, that is why.
Mistake 3: feeding a list of numbers or a mixed array
Not everything JSON-shaped has columns. A list of plain numbers has no keys. A single string has no keys. An array that mixes objects with numbers or strings has keys in some items and none in others, so there is no consistent header row to build.
The converter refuses these inputs with an explanation instead of guessing, and that refusal is by design: a tool that invented columns for a list of numbers would produce a table that looks plausible and means nothing, which is worse than an error message.
What it does accept: an array of objects (one row per object), a single object (a one-row table), and an array of arrays (one row per inner array). If your export is a mixed array, split it first and convert the object records on their own.
Mistake 4: expecting values to be reformatted
The last surprise is cosmetic. A date stays in whatever form the JSON held it. A number keeps its original shape. Capitalisation, spacing and ordering are untouched, because values are written as they appear and never reformatted.
This is deliberate. A converter that quietly rewrote values would be making editorial decisions about your data, and you would have no way to tell which cells it had touched. Any reformatting belongs to a step you control: fix the source JSON, or clean up in the spreadsheet after conversion.
How to convert JSON to CSV, step by step
- Open the JSON to CSV Converter and paste your JSON, or upload a .json file.
- Check the record and column counts the tool shows. If the column count is higher than expected, a record somewhere carries an extra key, which the union rule turned into a column.
- Download converted.csv and open it in your spreadsheet.
- Read the headers before the data: dot-style headers are flattened nested fields, and an empty-looking column marks a key only some records have.
Worked example: two records, three columns, one blank
Take this small array of objects:
[
{ "name": "Ana", "address": { "city": "Lisbon" } },
{ "name": "Ben", "address": { "city": "Porto" }, "age": 31 }
]
Ana has a name and an address. Ben has those, plus an age. The converter takes the union of keys (name, address.city and age, in first-appearance order), flattens the nested address, and produces:
name,address.city,age
Ana,Lisbon,
Ben,Porto,31
Ana's age cell is empty because her record never had an age. Nothing shifted and nothing was lost: the blank is the correct representation of a missing value.
Limitations and honest tradeoffs
Flattening is a one-way convenience. The dot-style headers record where values lived, but converting the CSV back will not rebuild the original nested objects; the structure has been written into names, not kept as structure. Arrays of objects survive only as JSON text in a cell: faithful, but not spreadsheet-friendly. And because values are never reformatted, inconsistencies in the source, like mixed date styles, pass straight through into the table.
Common mistakes
- Deleting sparse columns without reading them. A nearly empty column tells you which records carry a rare field. Check before you cut.
- Assuming a blank cell means the conversion dropped data. Blanks are missing values in the source, faithfully reported.
- Trying to convert a list of numbers. Scalars have no keys and no columns; the rejection is the tool working as designed.
- Expecting the converter to tidy values. It writes values as they appear. Reformatting is a separate, deliberate step.
- Hunting for lost nested data. It is in the dot-style headers. address.city is the address object, flattened.
FAQs
Why does my CSV have a column that is empty for almost every row? Because columns are the union of all keys across all records. If only one record carries a key, that key still becomes a column, and every other row is blank under it. The blanks are missing values, not lost data.
Why did my nested object turn into a header like address.city? CSV is a flat table, so nested objects are flattened dot-style. An address object with a city field becomes an address.city column. Nothing was dropped; the structure was written into the header name instead.
Why was my JSON rejected instead of converted? The converter accepts an array of objects, a single object, or an array of arrays. A list of plain numbers or strings, or an array mixing objects with other types, has no consistent set of columns, so it is rejected with an explanation rather than converted into a misleading table.
Why do the values in my CSV look exactly like the raw JSON? Because values are written as they appear and are never reformatted. Dates, numbers and text keep the form they had in the JSON. If you want a different format, change it in the source data or after conversion in your spreadsheet.
Is my JSON uploaded to a server when I convert it? No. The conversion runs fully locally in your browser and nothing is uploaded; the converted.csv you download is produced on your own device.
Conclusion
A converted CSV that looks misaligned is usually a faithful table wearing unfamiliar rules: union columns, dot-flattened headers, blanks for missing values, and no reformatting. Read it with those rules and the "lost" data is all accounted for. For the next step, opening the file in a spreadsheet and checking it there, see our companion guide on opening JSON data in Excel as a clean table. The full set of guides in this cluster lives in the Data and JSON Tools guides.
References
- RFC 4180, the common format for CSV files and how rows and fields are structured: https://www.rfc-editor.org/rfc/rfc4180
- MDN Web Docs, on working with JSON data and its types: https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/Scripting/JSON