# Convert JSON to CSV

> Convert JSON to CSV online. Free JSON to CSV converter with a worked example — turns an array of objects into spreadsheet-ready rows.

Need to open API data in Excel or Google Sheets? This converter takes an array of JSON objects, uses the keys as the header row, and writes each object as a comma-separated line, escaping any values that contain commas or quotes.

## Example: JSON → CSV

Input:
```
[
  { "id": 1, "name": "Ada", "role": "engineer" },
  { "id": 2, "name": "Linus", "role": "maintainer" }
]
```

Output:
```
id,name,role
1,Ada,engineer
2,Linus,maintainer
```

## How to convert JSON to CSV

1. Paste a JSON array of objects.
2. The keys of the first object become the CSV header.
3. Each object is written as a row; values with commas are quoted automatically.

## FAQ

### What if objects have different keys?

The header is taken from the first object. For predictable output, make sure every object shares the same set of keys.

### Are commas inside values handled?

Yes. Any value containing a comma, quote, or newline is wrapped in quotes and internal quotes are doubled, per the CSV convention.

## Related converters

- [CSV → JSON](https://www.devkult.com/convert/csv-to-json.md)
- [CSV → SQL](https://www.devkult.com/convert/csv-to-sql.md)
- [JSON → YAML](https://www.devkult.com/convert/json-to-yaml.md)

Open the interactive converter: https://www.devkult.com/convert/json-to-csv