# CSV to NDJSON Converter

Convert CSV to NDJSON in your browser — one JSON object per row for streaming pipelines, with type inference and custom delimiters. No upload.

## Run it

- **CLI:** `gizza tool csv-to-ndjson "name,age,active
Ada,36,true
Grace,,false"`
- **Web:** https://gizza.ai/tools/csv-to-ndjson/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/csv-to-ndjson/tool.json

## Inputs

- `data` — CSV _(field)_
- `delimiter` — Delimiter (, ; | or 'tab') _(field)_
- `headers` — First row is headers _(field)_
- `parse_numbers` — Parse numbers _(field)_
- `parse_bools` — Parse true/false/null _(field)_
- `trim` — Trim whitespace _(field)_

## Output

- NDJSON (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `data` — CSV
- `delimiter` — Delimiter (, ; | or 'tab')
- `headers` — First row is headers
- `parse_numbers` — Parse numbers
- `parse_bools` — Parse true/false/null
- `trim` — Trim whitespace

Example: `https://gizza.ai/tools/csv-to-ndjson/?data=name%2Cage%2Cactive%0AAda%2C36%2Ctrue%0AGrace%2C%2Cfalse&delimiter=%2C&headers=true&parse_numbers=true&parse_bools=true&trim=true`

---

## About this tool

**NDJSON** (newline-delimited JSON, also written `.ndjson` or `.jsonl`) puts one complete JSON
value on each line, with no enclosing array. That's the format streaming tools want: you can
process a huge file line-by-line without loading it all into memory, `cat` two files together,
`tail -f` a stream, or feed it straight into `jq -c`, a BigQuery load job, an Elasticsearch bulk
request, or a log shipper.

This converter parses your CSV — including quoted fields with embedded commas, newlines, and
`""` escapes (RFC 4180) — and emits one JSON object per data row. Everything runs locally in
your browser: your data never leaves the page.

### Worked example

Input CSV:

```
name,age,active
Ada,36,true
Grace,,false
```

Output NDJSON (defaults — every value stays a string, so nothing is lost):

```
{"name":"Ada","age":"36","active":"true"}
{"name":"Grace","age":"","active":"false"}
```

Turn on **Parse numbers** and **Parse true/false/null** and the same input becomes typed:

```
{"name":"Ada","age":36,"active":true}
{"name":"Grace","age":null,"active":false}
```

Untick **First row is headers** and each row is emitted as a JSON array instead of an object:
`["Ada","36","true"]`.

### Options

- **Delimiter** — `,` by default; also accepts `;`, `|`, the word `tab`, or any single
  character (great for TSV exports).
- **First row is headers** — on: keys come from the header row (objects). Off: rows become
  arrays.
- **Parse numbers** — numeric cells become JSON numbers. Values with leading zeros or a leading
  `+` (`007`, `+1`) stay strings, so zip codes and ids survive.
- **Parse true/false/null** — the literals `true`, `false`, and `null` (and empty cells) become
  JSON booleans / `null`.
- **Trim whitespace** — strips spaces around each cell before conversion.

## FAQ

<details>
<summary>What's the difference between NDJSON, JSONL, and a normal JSON array?</summary>

They describe the same idea: **NDJSON** and **JSONL** both mean "one JSON value per line, no
wrapping array." A normal JSON array (`[ {...}, {...} ]`) must be parsed as a whole; NDJSON can
be read one line at a time, which is why streaming and big-data ingest tools prefer it. This
tool outputs the line-delimited form; use the CSV to JSON tool if you want a single array.

</details>

<details>
<summary>Why are my numbers and booleans coming out as strings?</summary>

By default every cell is emitted as a JSON string, so nothing is silently reinterpreted. Tick
**Parse numbers** to turn numeric cells into JSON numbers and **Parse true/false/null** to turn
those literals into real booleans/null. Leaving them off is the safe, lossless choice for
pipelines that do their own typing.

</details>

<details>
<summary>Will it handle commas and newlines inside a quoted field?</summary>

Yes. Fields wrapped in double quotes may contain the delimiter, line breaks, and escaped quotes
(`""` → `"`), following RFC 4180. So `"Ada, L"` stays a single value and an embedded newline is
encoded as `\n` in the JSON output.

</details>

<details>
<summary>How do I convert a tab-separated (TSV) file?</summary>

Set the delimiter to the word `tab` (or paste an actual tab character). Any single character
works as a delimiter, so `;` and `|` exports convert the same way.

</details>

<details>
<summary>Is there a size limit and does my data get uploaded?</summary>

Nothing is uploaded — the conversion happens entirely in your browser via WebAssembly, so your
data stays on your machine. Because it all runs in memory, extremely large files (hundreds of MB)
may be slow or hit the browser tab's memory limit; for those, a command-line NDJSON converter is
a better fit.

</details>

## Related tools

- [Data Format Converter](https://gizza.ai/tools/data-format-converter/): Convert data between CSV, TSV, JSON, and NDJSON (JSONL) in any direction — auto-detects the source, infers types, unions keys. Free, in-browser, no upload.
- [CSV ⇄ JSON Converter](https://gizza.ai/tools/csv-json-convert/): Convert CSV to JSON or JSON to CSV in your browser — auto-detects direction, infers types, handles quoted fields and custom delimiters. Free, no upload.
- [Amazon Order Analyzer](https://gizza.ai/tools/amazon-order-analyzer/): Paste an Amazon order-history CSV export to summarize total spend by month, top items, and category breakdowns. Browser-only, private, with Markdown or JSON output.
- [Avro to JSON Converter](https://gizza.ai/tools/avro-to-json/): Decode Apache Avro Object Container Files (.avro / OCF) to JSON, NDJSON, or the embedded schema — no .avsc needed, free and private in your browser.
- [Reconcile bank statement and ledger CSVs](https://gizza.ai/tools/bank-statement-reconcile/): Match bank-statement CSV rows to ledger rows by date, signed amount, and fuzzy memo similarity, with unmatched and suggested matches.
