### JSON

_\[ { "a": 1, "b": 2 }, { "a": 3, "b": 4 } \]_Flatten nested objects with dotted keys

Clear  Copy

Reverse direction: [CSV to JSON](https://www.toolcomb.com/csv-to-json).

### CSV Copy

```
a,b
1,2
3,4
```

# JSON to CSV Converter - Arrays of Objects to Spreadsheet Rows

Turn an array of JSON objects into spreadsheet-ready CSV. Choose how to handle nested fields, review the columns, and copy the result in your browser.

## What Is a JSON to CSV Converter?

A **JSON to CSV converter** turns an array of objects into a table: object keys become column headers and each object becomes a row. You can also convert a single object. JSON can contain nested structures that do not fit neatly into a table, so review the selected handling before importing your CSV.

For example, `[{"a":1,"b":2},{"a":3,"b":4}]` produces:

```
a,b
1,2
3,4
```

That is the worked check. A single object is wrapped as one row so you are not stranded, but a nested config file is still a tree. Flatten mode turns `{"user":{"id":1}}` into a `user.id` column. Stringify mode puts the nested object in one cell as JSON text. Arrays as cell values stringify. Missing keys across the union of columns become empty cells.

This is the opposite direction of the existing [CSV to JSON](https://www.toolcomb.com/csv-to-json) converter. It will not silently rebuild comments, original quoting quirks, or a column order that never existed as object key order in JSON. Huge tables belong in a local script or the [JSON file processor](https://www.toolcomb.com/json-file-processor), not a textarea.

Values containing commas, newlines or quotes are quoted as needed for CSV. Spreadsheet apps may interpret identifiers as dates or strip leading zeroes, even if the source value is a string; choose text as the column type during import when exact formatting matters. Treat CSV from untrusted sources with care: cells beginning with formula characters can be interpreted as formulas by spreadsheet software.

Headers are the union of keys after flatten or stringify. A property that appears only on the second row still becomes a column. Missing cells on other rows stay empty. That sparse-table behavior is the usual CSV import contract. You do not have to pad every object with null first unless you want a visible null token - this page treats JSON null as an empty field on purpose.

## How to Convert JSON to CSV - Step by Step

Conversion is live as you type, once the document parses:

1. **Paste JSON** - The default is `[{"a":1,"b":2},{"a":3,"b":4}]`. An array of objects is the reliable mapping. A single object is wrapped as one row.
2. **Choose nested handling** - Flatten dotted keys such as `user.id`, or stringify nested objects into a single cell. Arrays as cell values stringify.
3. **Read the CSV in the right panel** - Headers include keys from every row. Missing cells stay empty. The default produces a,b followed by 1,2 and 3,4.
4. **Copy the CSV** - Use Copy to place the result on the clipboard for a spreadsheet or database import. Clear restores the default two-row array. Nothing is uploaded.
5. **Fix parse errors first** - If the input is not valid JSON, use the [JSON validator](https://www.toolcomb.com/json-validator) or [JSON repair](https://www.toolcomb.com/json-repair), then convert.
6. **Stay modest in the textarea** - Tens of thousands of rows may still work on a desktop. Multi-megabyte tables do not belong here.

## JSON to CSV Example - Default Rows and Nested Flatten

Two worked examples. The first is the default on this page. The second shows why flatten exists.

### Default array of objects

```
[
{ "a": 1, "b": 2 },
{ "a": 3, "b": 4 }
]
```

CSV output:

```
a,b
1,2
3,4
```

### Nested object - flatten on

```
[
{ "user": { "id": 1 }, "ok": true }
]
```

Flatten emits a `user.id` column plus `ok`. Stringify instead puts `{"id":1}` in the `user` cell and leaves `ok` as a boolean. Duplicate logical columns after flattening (a nested path and a literal dotted key) last-write-wins in the flattened map.

A JSON array of primitives such as `[1, 2, 3]` is not an array of objects. The tool reports that it needs an array of objects or one object. Wrap records first, or convert in a script.

## When You Need JSON to CSV - Real-World Use Cases

### Opening an API list in a spreadsheet

REST endpoints often return an array of objects. Pasting that array here produces a header row and one spreadsheet row per object. Analysts can then filter, pivot, and chart without writing a Python one-liner. Flatten nested user or address objects when those should become columns.

### Preparing a database import

Many warehouses and admin UIs import CSV, not JSON. Converting an array of records locally avoids uploading the JSON to a third-party converter. Empty cells for missing keys match how CSV imports usually treat optional columns.

### Comparing two exports in Excel

JSON diffs are trees. Spreadsheet diffs are tables. If both dumps are arrays of objects with stable keys, CSV is the format that Excel and Google Sheets already know how to highlight. Flatten first so nested ids become columns you can VLOOKUP.

### Keeping nested blobs in one cell

To keep a nested object in one field, turn flatten off. The object is represented as JSON text inside the cell; arrays are handled the same way.

### Cleaning rows in the JSON editor first

If objects are messy, edit them in table mode on the [JSON editor](https://www.toolcomb.com/json-editor), then paste the array here. This converter does not rename keys or drop columns; it only unparses what you give it.

### Documenting a sample table in a ticket

A two-row default is already a complete CSV example. Replace a and b with the keys your API actually uses, copy the CSV, and paste it into a GitHub issue. Reviewers who do not read JSON still see a table.

### Handling sparse objects

Row one may have keys a and b; row two may add c. Headers are the union. Missing cells stay empty. That is how CSV represents optional fields. You do not need to pad objects with null first unless you want the word null in a cell - this page treats JSON null as an empty field.

### Avoiding a huge-file textarea

For a large document, use the [JSON file processor](https://www.toolcomb.com/json-file-processor) to inspect it first, then convert a smaller sample. Very large tables may require a local conversion workflow.

## Flatten vs Stringify vs CSV to JSON

Three nearby choices. Mixing them up produces either extra columns or JSON-in-a-cell surprises:

| Goal | Flatten on | Flatten off | CSV to JSON |
| --- | --- | --- | --- |
| Nested object as columns | ✓ user.id |  | N/A (other page) |
| Nested object as one cell |  | ✓ stringify | N/A |
| Default two-row a,b / 1,2 / 3,4 | ✓ | ✓ | Reverse |
| Rebuild original CSV quoting | No | No | Not guaranteed |
| Spreadsheet import | ✓ | If nested stays in one field | Opposite |
| Array of primitives | Error | Error | Table → objects |
| Huge file | Not this textarea | Not this textarea | Not this textarea |
| CSV field quoting | ✓ | ✓ | Reads CSV |

The general rule: **flatten for columns, stringify for blobs, CSV to JSON when you already have a table.**

## Common JSON to CSV Errors - Shape, Parse, Collisions

These are the failures this converter reports or silently last-write-wins. They are not pretty-print errors:

- **Not JSON.** Trailing commas and single quotes can cause a syntax error. Fix the input before converting.
- **Not an array of objects.** `[1,2,3]` or a string root is not a table. Wrap records. A single object is allowed as one row.
- **Empty array.** `isArrayOfObjects` requires at least one object. An empty array is not a header source.
- **Nested arrays in a cell.** They stringify. They do not become extra rows. Row explosion is a different job (unnest in a script).
- **Flatten key collision.** A nested path `user.id` and a literal key `"user.id"` last-write-wins in the flattened map.
- **Null cells.** JSON `null` becomes an empty CSV field. If you need the word null, stringify a sentinel or convert in a script.
- **Booleans and numbers.** Spreadsheets may interpret values differently when importing. Check column types after import.
- **Huge input.** Large arrays may slow the browser. Try a smaller sample or a local workflow.

## Privacy & Security - Browser-Based Conversion

Conversion runs in your browser and the tool does not upload the array for processing. Browser extensions, shared devices and copied or exported data may still expose its contents.

Drafts including the flatten checkbox are saved under a unique storage key for up to 30 days. Click Clear to restore the default two-row array and turn flatten back on. Panel width is stored separately. Do not leave production customer tables in localStorage on a borrowed laptop.

## Frequently Asked Questions

### What JSON shape converts to CSV?

A JSON array of objects. The default `[{"a":1,"b":2},{"a":3,"b":4}]` becomes the header a,b and two data rows. A single object is wrapped as one row so you are not stranded, but a nested config tree is still a tree, not a table.

### How are nested objects handled?

Flatten mode turns `{"user":{"id":1}}` into a user.id column. Stringify mode puts `{"id":1}` in one cell as JSON text. Arrays as cell values stringify. Choose flatten when you want spreadsheet columns; choose stringify when nested structure should stay in one field.

### Is this the reverse of CSV to JSON?

Yes, in spirit. CSV to JSON already exists on this site. JSON to CSV is the opposite direction and will not silently rebuild comments, original quoting quirks, or a column order that never existed as object key order in JSON.

### Does conversion upload the data?

No. Conversion runs in your browser. Drafts are saved locally for up to 30 days. Clear restores the default two-row array.

### What about duplicate headers?

Object keys are unique in JSON after parse. Flattening can still collide if one row has both user.id as a nested path and a literal "user.id" key; later values win in the flattened map. That is a last-write-wins map, not a CSV error.

### Can I convert a huge file?

Browser memory and device performance limit the size you can convert. Try a representative sample first; for very large tables, consider a local conversion workflow.

### What happens to null, booleans, and arrays?

Numbers and booleans become CSV values. Null and missing keys become empty fields, while arrays in cells become JSON text. Review how your spreadsheet imports each column.

### Does column order follow the first object only?

Headers include keys from all rows, in the order they first appear after nested handling. A key present only in a later row still becomes a column; missing cells stay empty.

### Can I convert a single JSON object?

Yes. A single object is wrapped as one row. That is a convenience, not a claim that every JSON document is a table. Deeply nested configs still need flatten or stringify, and arrays of primitives are not objects.

### Is this JSON to CSV converter free?

Yes. No signup, no row cap beyond what your browser will hold, and no upload. Convert as many arrays as you need, then copy the CSV into a spreadsheet or a database import.

## Related JSON & Table Conversion Tools

CSV is one export. These pages cover the rest of the table and JSON workflow:

- [CSV to JSON](https://www.toolcomb.com/csv-to-json) - The reverse direction: tabular text to an array of objects.
- [JSON Editor](https://www.toolcomb.com/json-editor) - Clean rows in table mode before you unparse.
- [JSON Formatter](https://www.toolcomb.com/json-formatter) - Pretty-print the array if you need to read it as JSON first.
- [JSON Validator](https://www.toolcomb.com/json-validator) - RFC 8259 syntax when the left panel will not parse.
- [JSON File Processor](https://www.toolcomb.com/json-file-processor) - Worker parse for large files that do not belong in this textarea.
- [JSON Schema Validator](https://www.toolcomb.com/json-schema-validator) - Confirm record shape before you treat the array as a table.
- [JSON Query](https://www.toolcomb.com/json-query) - Extract a smaller array with JSONPath, then convert that slice.
- [JSON Compare](https://www.toolcomb.com/json-compare) - Diff two arrays as trees when CSV is the wrong comparison format.

## Related Tools

Discover more free tools that might help with your next task.

[XML to JSON Convert XML data to JSON format Use Tool](https://www.toolcomb.com/xml-to-json)

[CSV to JSON Convert CSV data to JSON format Use Tool](https://www.toolcomb.com/csv-to-json)

[YAML to JSON Convert YAML data to JSON format Use Tool](https://www.toolcomb.com/yaml-to-json)

[Array to Image Convert array data to visual image representation Use Tool](https://www.toolcomb.com/array-to-image)

[Bitmap to Array Convert bitmap images to array data Use Tool](https://www.toolcomb.com/bitmap-to-array)

[Timezone Converter Convert time between different timezones Use Tool](https://www.toolcomb.com/timezone-converter)

### Related guides

Read the how-to, then come back to this tool when you are ready to run it locally.

- [Best Free CSV, Chart, and File Inspector Tools Browser-local CSV editing, chart PNG export, bill splits, ZIP listing, and EPUB metadata - no account and honest limits on what each tool can do.](https://www.toolcomb.com/blog/best-free-csv-chart-and-file-inspector-tools)

[View All Tools](https://www.toolcomb.com/tools)
