1001Ferramentas
🔁 Converters

CSV ↔ NDJSON

Two-way conversion between CSV and NDJSON (Newline Delimited JSON), preserving numeric types when detected.

Saída:

CSV to NDJSON, one object per line

NDJSON, or JSON Lines, is the format with one JSON object per line. It became the standard input for stream processing tools, for bulk loading into document databases and for training sets, because it lets you read record by record without holding the whole file in memory. Spreadsheets and system exports, on the other hand, almost always come out as CSV.

The conversion runs both ways: pick the direction and paste. From CSV to NDJSON, each record becomes a JSON line with the header row naming the fields; on the way back, the keys of all objects form the header, in the order they first appeared. The CSV reader is complete enough where it counts: a quoted field containing a comma, doubled quotes representing a literal quote, and a line break inside a quoted field are all handled correctly — which is precisely where improvised converters fall over.

A note on types: values come out as text. A CSV carries no types at all — the number 007 might be a code that must keep its leading zeros, and converting it to a number would destroy it. If the destination needs real numbers or booleans, that type conversion is the consumer's decision, made with knowledge of what each column means.

Frequently asked questions

Why one line per object rather than an array?
Because that is what allows stream processing. With an array, the reader has to wait for the closing bracket to have valid JSON; with one object per line, each line is already a complete document. That is why logging and bulk-loading tools prefer this format.
What if the CSV has repeated column names?
The last one wins, because each row becomes an object and a repeated key overwrites. If your CSV has duplicate headers, rename them before converting — otherwise the loss happens silently.
Can the file be large?
The conversion happens in browser memory, so a file of hundreds of megabytes will freeze the tab. At that size the route is a command-line tool that processes as a stream. This page handles the size you copy and paste comfortably.

Related Tools