# CSV and JSON Converter

Convert CSV to JSON, or JSON back to CSV, with configurable delimiter and pretty-printing.

- Category: Data (data)
- URL: https://ilham.dev/tools/csv-json-converter/
- Documentation: https://ilham.dev/tools/csv-json-converter/index.md
- Keywords: csv, json, convert, delimiter, header, objects, rows, data, tsv

## Example questions

- What does the JSON have to look like?
- Where does the extra header come from?
- Are values converted to numbers?

## Properties

- Runs in the browser
- No login required
- No data uploaded


## About

Move between the two shapes that CSV and JSON use for tabular data. Going to JSON, each row becomes an object keyed by the header; going to CSV, the keys become the header and any key a row is missing is left empty. The delimiter is detected for CSV input and can be set by hand.


## Questions

### What does the JSON have to look like?

An array. Each item can be an object, whose keys become columns, or an array, which is written as a plain row. Anything that is not an array is rejected with a message rather than a partial result.

### Where does the extra header come from?

When objects have different keys, the header is the union of all of them, in the order the keys first appear. A row that lacks one of those keys simply gets an empty cell.

### Are values converted to numbers?

No. CSV cells are text, so 120 in a CSV file becomes the string "120" in JSON. Convert the types in your own code if the number matters.

