# CSV to JSON

> Convert CSV rows to a JSON array of objects locally in your browser.

Canonical: https://host-tools.com/tools/csv-to-json/

---

## What does this tool do?

It turns a CSV table into a JSON array of objects. The first row is read as the header, and each
following row becomes an object. Everything runs locally in your browser.

## How values are typed

Every cell is trimmed and then converted automatically:

| Cell | Becomes |
| --- | --- |
| `true` / `false` | boolean |
| `null` | `null` |
| `42`, `-3`, `7.5` | number |
| empty | empty string |
| anything else | string |

There is no switch to turn this off, which matters for values that only *look* numeric:

- **Leading zeros are lost.** `01234` becomes `1234`, so postal codes and zero-padded ids get
  corrupted.
- **Long integers lose precision.** Past 15–16 digits JavaScript numbers round:
  `12345678901234567890` becomes `12345678901234567000`.
- **`007.50` becomes `7.5`.**

If those values matter, make them non-numeric before converting (a text prefix such as `zip:01234`,
for example) and strip it from the JSON afterwards.

## Delimiters and quoting

- Only the **comma** separates fields. Semicolon- or tab-separated files are read as a single
  column, so convert them to commas first.
- Fields may be quoted with `"` and contain commas or line breaks. A doubled quote (`""`) is one
  literal quote.
- CRLF, CR and LF line endings are all accepted.
- A column with an **empty header is skipped**.
- If two headers share a name, the **last column wins** and the earlier one is dropped.
- Blank rows are ignored.

## Converting back is not lossless

JSON to CSV and back is a one-way trip for types: a number becomes a number again, an empty field
becomes `""` rather than staying absent, and `null` comes back as an empty value. Keep the original
file if you need an exact round trip.
