Skip to content

Convert

CSV to NDJSON

CSV to NDJSON

Beta

Convert a spreadsheet CSV into newline-delimited JSON (.ndjson, .jsonl) in your browser: one JSON object per line, keyed by the header row, with optional type coercion. Nothing is uploaded.

Use via API
  • Free, no sign-up
  • REST + MCP
  • Updated
  • Reviewed by Olgun Ozoktas

Converted in your browser. We do not upload the file. The header row becomes the keys. Nested JSON is not rebuilt from dotted column names. A huge file is limited by tab memory, so use Download, not Copy, for a big output.

CSV
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
JSON Lines (NDJSON)

One JSON object per line will appear here..

Why Use Our CSV to NDJSON Converter?

A log shipper, a bulk loader and a fine-tune job read one JSON object per line, a format called JSON Lines, NDJSON or JSONL. A spreadsheet exports CSV. The usual bridge is a short Python script or a JSON array split with jq, and both take longer than the export itself. This page reads the CSV per RFC 4180, so a quoted comma or a line break inside a cell stays inside the value, and writes one JSON object per line with the header as keys. Every value stays a string unless you turn on Coerce types, which is the safe default for zip codes and ids. The conversion runs in your browser; the file never leaves the tab.

JSON Lines, also called NDJSON or JSONL, holds one JSON value per line. A loader reads it a line at a time, which is why bulk import tools, log shippers and fine-tune jobs prefer it to a JSON array. A spreadsheet knows nothing about it and exports CSV. This page is the bridge: it reads the CSV per RFC 4180 and writes one JSON object per line, in header order, with LF line ends.

The header row becomes the keys. Names are trimmed, an empty name becomes column_N, and a duplicate name gets a numeric suffix so no value is lost. The separator is detected from the header among comma, semicolon, tab and pipe, or set by hand. A quoted field may hold the separator, a doubled quote or a line break and stays one value. A row wider than the header keeps the first values and is named in the notes; a narrower row fills the missing keys with an empty string, or null under Coerce types. Blank lines are skipped and counted.

Every value is a string by default, because a CSV has no types and a wrong guess corrupts data silently. With Coerce types on, true and false become booleans, null and an empty cell become null, and a plain number becomes a JSON number. A number with leading zeros stays text, and an integer of 2^53 or more stays text so a 64-bit id keeps every digit. Dotted header names are not rebuilt into nested objects. The input cap is 10 MB. Nothing is uploaded; the file is converted in your browser.

How it compares

A pandas script or a jq pipeline does the same job when the tools are installed and someone writes the type rules. Online converters that upload the CSV send a customer list or a dataset to a server for a format change. This page reads the CSV properly, makes the type decision explicit with one switch, names the rows it changed, and keeps the file in the tab.

CSV to NDJSON Tips

  • Coerce types turns true and false into booleans, null and an empty cell into JSON null, and a plain number into a JSON number. 007 stays the string 007, and an integer of 2^53 or more stays a string so no digit is lost.
  • Dotted header names such as user.name stay flat keys. The tool does not rebuild nested objects, so the key in the JSON is the text user.name.
  • An empty header cell becomes column_N. A duplicate header gets a suffix: the second a is a_2. The notes say which names changed.
  • A row with more values than the header keeps the first values and is named in the notes with its row number. The header is row 1.
  • The output has LF line ends and one trailing newline. .ndjson and .jsonl are the same format under two names.

Frequently Asked Questions

What is the difference between .ndjson and .jsonl?

None in the content. Both hold one JSON object per line with line-feed separators. .ndjson stands for newline-delimited JSON and .jsonl for JSON Lines. The download is named .ndjson; rename it to .jsonl if a loader checks the extension.

Why is every value a string?

A CSV carries no types, so 007, 1e5 and a phone number are all just text. Turning text into numbers by guessing is how a zip code loses its leading zero. Values stay strings unless you turn on Coerce types, and then only true, false, null, an empty cell and a plain number change.

What exactly does Coerce types change?

true and false become booleans. null and an empty cell become JSON null. A plain number such as 42, -3.5 or 1e3 becomes a JSON number. A number with leading zeros stays a string. An integer of 2^53 or more, for example a 64-bit id, stays a string so no digit is lost. 1.0 becomes the number 1.

Can I get nested objects from dotted column names?

No. A header user.name produces the flat key user.name. Rebuilding nested objects would need a rule for arrays and for keys that contain a dot, and a wrong rule changes data silently. If you need nested JSON, convert the flat JSON in a script that knows your schema.

How is the separator detected?

The header line is split with a comma, a semicolon, a tab and a pipe, and the one that gives the most fields wins. A file that uses semicolons is read correctly without a setting. Pick the separator by hand when the header contains the other character inside a quoted name.

What happens to a row with the wrong number of values?

A row with more values than the header keeps the first values and is named in the notes with its row number; the header counts as row 1. A row with fewer values fills the missing keys with an empty string, or null when Coerce types is on. Blank lines are skipped and counted in the status line.

What if two header cells have the same name?

The second one gets a suffix: a and a_2, then a_3. An empty header cell becomes column_N with its position. The notes list every renamed key so you can fix the header in the sheet if you prefer.

Is my file uploaded anywhere?

No. The CSV is parsed and the JSON Lines are written in your browser, and no request carries the file. You can confirm that in the browser's network panel while converting.

How large a file can I convert?

The input cap is 10 MB of text. The conversion runs in the tab, so a file near the cap can keep the browser busy for a moment. Use Download rather than Copy for a large output. For a batch or a script, the same converter is on the FindUtils API as csv_to_ndjson.

How do I convert NDJSON back to CSV?

Use the NDJSON to CSV tool, or flip the direction toggle on this page. It builds the header from every key across every line, flattens nested objects to dot paths, and skips a bad line with a note.

Rate This Tool

0/1000

Get Weekly Tools

Suggest a Tool