Convert JSON to CSV: Flatten Nested Objects Safely
Convert JSON to CSV free. Flatten nested objects into dotted columns, keep lists in one cell, choose delimiter and line endings, and download a CSV file.
To convert JSON to CSV, paste an array of objects, choose a delimiter and line ending, and press Convert. Nested objects are flattened into dotted columns such as address.city, lists stay as compact JSON inside one cell, and missing values become empty cells. The conversion runs in your browser.
That flattening behaviour is what makes the output usable in a spreadsheet. CSV has no concept of a nested object, so a JSON record like {"user":{"name":"Ada","age":36}} has to become columns. The two honest options are to flatten with dotted names or to dump the whole object into one cell. This tool flattens, which keeps the values sortable and filterable.
What the converter accepts
The input can be:
- An array of objects — the normal case, one row per object.
- A single object — becomes one row.
- An array of scalars — becomes rows with a single
valuecolumn. - A single scalar — one row, one
valuecolumn.
Anything else, or input that is not strict JSON, returns an error. The input limit is 500,000 characters.
How to convert JSON to CSV
- Open the JSON to CSV converter.
- Paste your JSON.
- Choose a delimiter: comma (default), semicolon, pipe or tab.
- Leave Flatten nested objects checked to get dotted column names. Uncheck it to keep nested objects as JSON in a single cell.
- Choose line endings: LF for Unix and the web, CRLF for older Windows tools.
- Press Convert.
- Copy the CSV or download it, then open it in a spreadsheet.
The result shows the row and column counts and lists the generated column names, which is the quickest way to confirm that flattening produced the shape you expected.
Flattened vs unflattened
| Setting | address object |
Best for |
|---|---|---|
| Flatten on (default) | address.city, address.zip columns |
Sorting, filtering, spreadsheet analysis |
| Flatten off | One address column containing {"city":"London"} |
Preserving the original shape for re-import |
Flattening is recursive: deeper objects become longer dotted paths, such as user.address.city. Lists are not exploded into numbered columns. A list inside a field stays as compact JSON in one cell, because a list has no key to flatten onto. That is a deliberate limit: expanding arrays would either produce a variable number of columns or duplicate rows, and both are surprising.
How values are written
Values are written the way JSON spells them:
- Strings are written as their text, quoted by the CSV rules when they contain a delimiter, quote or newline.
- Numbers are written without quotes.
- Booleans become
trueandfalse. nullbecomesnullin the cell, not an empty string, unless the key is missing entirely.
That distinction matters on re-import. An empty cell means "no value present", while null is an explicit null. Many CSV consumers treat them the same, but the converter does not silently collapse them.
Columns and missing keys
Records do not have to share the same keys. The converter builds the header as the union of all keys, in the order they first appear. A record missing a column gets an empty cell, and the notes report how many rows were short.
This is the behaviour you want for real API data, where optional fields appear in some records and not others. The alternative — taking the keys from the first object only — silently drops data from later records.
Common problems and fixes
Every value is in one column. The delimiter does not match what your spreadsheet expects. Try comma for a standard CSV, semicolon for locales where comma is the decimal separator, or tab for TSV.
Nested objects are unreadable in one cell. Flattening is off. Enable it to get dotted columns.
A list became a JSON string. That is by design. Lists stay in one cell as compact JSON because there is no stable set of columns to expand them into.
Columns appear in a different order than expected. The header follows first appearance across records, not alphabetical order and not the key order of a single object.
Leading zeros disappeared when I opened the CSV. The file contains the text 01234, but the spreadsheet interpreted it as a number. Import the column as text, or prefix with an apostrophe in the spreadsheet.
Dates or large numbers changed. Spreadsheets apply their own parsing and precision rules. IDs beyond 15 digits can lose precision when opened in Excel. Import as text for identifiers.
The input is rejected. It must be strict JSON. Comments, trailing commas and single quotes are not accepted; the JSON formatter will locate the error.
The output has a stray blank line. A record with no keys produces an empty row. Remove empty objects from the source if that is not meaningful.
Tips for spreadsheet-ready output
- Use an array of objects. It is the only shape that maps cleanly to rows and columns.
- Keep keys consistent. Optional keys are supported, but a stable schema produces a tidier sheet.
- Flatten before exporting. Dotted names are easier to work with than JSON blobs in cells.
- Choose CRLF for Excel on Windows if the file will be opened there directly; LF is fine for most modern tools and for the web.
- Import IDs as text. A 16-digit order number is not a number a spreadsheet can represent exactly.
- Convert back to JSON after editing. The CSV to JSON converter handles the reverse direction, including typed values and quoted fields.
- Keep the source JSON. The CSV is a view for analysis, not a lossless replacement for the original structure.
What CSV cannot preserve
A round trip through CSV is not lossless. Three things are lost or changed:
- Nesting. Flattened dotted keys are a convention, not a schema. Converting back does not automatically rebuild the original objects.
- Types on re-import. A CSV cell is text. The reverse converter recognises numbers, booleans and nulls, but a date or a UUID is still a string.
- Key order and formatting. JSON whitespace and formatting disappear, and the column order is a union rather than each object's own order.
For analysis and sharing, that is an acceptable trade. For storage or an API payload, keep the JSON.
Frequently asked questions
Is the JSON to CSV converter free?
Yes. There is no account and no charge.
Is my JSON uploaded?
No. The conversion runs in your browser, and the input is not stored.
How are nested objects handled?
By default they are flattened into dotted column names such as address.city. You can turn flattening off to keep each nested object as JSON in a single cell.
How are arrays handled?
A list inside a field stays as compact JSON in one cell. Top-level arrays of scalars become rows with a single value column.
Can I choose the delimiter?
Yes: comma, semicolon, pipe or tab. Line endings can be LF or CRLF.
What happens when records have different keys?
The header is the union of all keys. Missing values become empty cells, and the result reports how many rows were short.
Bottom line
JSON to CSV is really a question of how to flatten structure without losing the values you need. Keep flattening on for analysis, accept that lists stay in one cell, and import identifiers as text. Open the JSON to CSV converter, check the column list before downloading, and use the CSV to JSON converter when the spreadsheet work is done.
Related posts
View allIBAN Validator: Check an IBAN Before You Send Money
One mistyped character can bounce a payment. Check the country, length and mod-97 checksum of an IBAN before you send it.
Base64 Encode and Decode: A Practical Guide
Encode text to Base64 or decode it free in your browser. UTF-8 safe, line breaks tolerated, size and character counts shown, with errors on invalid input.
Convert CSV to JSON: Keep Types and Headers Right
Convert CSV to JSON free with auto delimiter detection, typed numbers and booleans, duplicate-header handling and 2/4-space or tab output. Runs in browser.
Comments (0)
Be the first to share feedback on this post.