csvjson

Convert JSON to NDJSON Online

Export a JSON array to newline-delimited JSON — one compact object per line. Ready for Elasticsearch bulk imports, BigQuery, Segment, Kafka, and D3.

JSON → NDJSON

Free JSON to NDJSON converter. Convert a JSON array to newline-delimited JSON (JSONL) for Elasticsearch, BigQuery, Segment, and streaming pipelines. Works in your browser.

100% local — no uploads
Input · JSON

Output will appear here

How to use the JSON → NDJSON

  1. Paste or upload your JSON data

    Paste text directly into the input box, drag and drop a file onto it, or click "Upload file" to browse. Conversion starts instantly on paste — no button click required.

  2. Configure options (optional)

    Open the Options panel to customise delimiter, headers, nested-object flattening, and more. Use the Field Selector to pick exactly which columns appear in the output.

  3. Copy or download your NDJSON

    Click Copy to grab the result, or Download to save the file. Everything runs locally in your browser — no data ever leaves your device.

Frequently Asked Questions

Is my data safe?
Yes. Every conversion runs entirely inside your browser. No data is ever transmitted to a server. The tool works offline once loaded.
What is the maximum file size?
There is no hard limit. Files under 1 MB convert instantly. Files 1–10 MB show a progress indicator. Files over 10 MB prompt a warning and run in a background thread to keep the browser responsive.
Why does my JSON fail to parse?
Common causes are trailing commas, single-quoted strings, unquoted keys, or missing closing brackets. The converter auto-repairs many of these and tells you exactly what it changed.
Can I convert multiple files at once?
The tool handles one file at a time. For bulk conversion, consider the csvjson CLI or API.

How it works

Step 1

One compact object per line

Each element of the JSON array is serialized as a compact single-line JSON string. The output has no outer array brackets — just one object per line, separated by newlines.

Step 2

Ready for streaming consumers

NDJSON can be appended to without rewriting the file and consumed line-by-line without buffering the entire payload. Elasticsearch bulk, BigQuery streaming inserts, Segment track calls, and D3 dsv all accept this format.

Step 3

Paste, convert, upload

Paste your JSON array, get NDJSON output instantly. Copy to clipboard or download as .ndjson — then pipe directly into curl, the Elasticsearch bulk API, bq load, or any other CLI tool.

Example

Preparing records for an Elasticsearch bulk index operation

Input
[
  { "id": 1, "user": "alice", "score": 98 },
  { "id": 2, "user": "bob",   "score": 74 },
  { "id": 3, "user": "carol", "score": 88 }
]
Output
{"id":1,"user":"alice","score":98}
{"id":2,"user":"bob","score":74}
{"id":3,"user":"carol","score":88}

Each line is valid standalone JSON. Pipe with curl: curl -s -H 'Content-Type: application/x-ndjson' --data-binary @output.ndjson http://localhost:9200/_bulk

Edge cases, handled

Nested objects preserved

Nested objects and arrays are kept intact — serialized as compact inline JSON on their line, not flattened. Each line is still valid JSON.

Single object input

If you paste a single JSON object instead of an array, it is treated as a one-element array and emitted as a single NDJSON line.

Unicode and special characters

JSON.stringify handles all Unicode escaping automatically — emoji, CJK characters, and control characters are safely encoded.

Frequently asked questions

What is NDJSON and how is it different from JSON?

Standard JSON wraps everything in a single array or object. NDJSON (also called JSONL or JSON Lines) puts one complete JSON object on each line, with no outer wrapper. This makes it streamable — you can process line-by-line without loading the whole file, and append new records without rewriting the entire document.

How do I use this for Elasticsearch bulk imports?

Elasticsearch bulk API uses alternating action/document pairs in NDJSON format. Build a JSON array with your action objects (e.g. {"index":{"_index":"my-index"}}) and document objects interleaved, convert to NDJSON, and POST to /_bulk with Content-Type: application/x-ndjson.

Does BigQuery accept NDJSON?

Yes. BigQuery's bq load command accepts NDJSON with --source_format=NEWLINE_DELIMITED_JSON. Each line becomes one row in the table. This is also the format BigQuery uses for its own JSON exports.

What's the file extension for NDJSON?

.ndjson is the most common. You'll also see .jsonl (used by BigQuery and Python's jsonlines library) and .json (when the format is implied by context). All three are the same format.

Can I go the other direction — NDJSON back to JSON?

Yes. Use the NDJSON → JSON direction on this same page (toggle the button above the tool) to parse a newline-delimited file back into a standard JSON array.