csvjson

NDJSON ↔ JSON Converter

Parse newline-delimited JSON into a JSON array, or export a JSON array to NDJSON — for Elasticsearch, BigQuery, Segment, Kafka, and D3. Malformed lines are flagged with line numbers, not silently dropped.

NDJSON → JSON

Parse newline-delimited JSON into a standard JSON array. Malformed lines are flagged with line numbers.

100% local — no uploads
Input · NDJSON

Output will appear here

How to use the NDJSON → JSON

  1. Paste or upload your NDJSON 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 JSON

    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 NDJSON 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

NDJSON → JSON: each line is an independent object

NDJSON (also JSONL / JSON Lines) stores one complete JSON object per line. The converter parses each line individually and collects them into a standard JSON array ready for any downstream tool.

Step 2

JSON → NDJSON: one compact object per line

The reverse direction takes a JSON array and serializes each element as a compact single-line JSON string. The result can be streamed line-by-line, appended to without rewriting the file, and consumed by Elasticsearch bulk, BigQuery, Segment, and D3.

Step 3

Malformed lines are flagged, not silently dropped

Bad lines (split log entries, plaintext mixed into a structured log) show up as warnings with their exact line number. You keep any valid lines while seeing precisely where the problem is.

Examples

CloudWatch log export and Elasticsearch bulk import

NDJSON → JSON
Input (log export)
{"ts":"2024-01-15T10:22:01Z","level":"INFO","ms":12}
{"ts":"2024-01-15T10:22:02Z","level":"ERROR","ms":5003}
{"ts":"2024-01-15T10:22:03Z","level":"INFO","ms":9}
Output (JSON array)
[
  {"ts":"2024-01-15T10:22:01Z","level":"INFO","ms":12},
  {"ts":"2024-01-15T10:22:02Z","level":"ERROR","ms":5003},
  {"ts":"2024-01-15T10:22:03Z","level":"INFO","ms":9}
]
JSON → NDJSON
Input (JSON array)
[
  { "index": "_doc", "id": "1" },
  { "user": "alice", "score": 98 },
  { "index": "_doc", "id": "2" },
  { "user": "bob",   "score": 74 }
]
Output (NDJSON / bulk)
{"index":"_doc","id":"1"}
{"user":"alice","score":98}
{"index":"_doc","id":"2"}
{"user":"bob","score":74}

Edge cases, handled

JSONL / JSON Lines

NDJSON, JSONL, and JSON Lines are the same format with different names. BigQuery calls it JSONL; the formal spec says NDJSON. This converter handles all three.

Malformed lines with line numbers

Any line that can't be parsed as JSON produces a warning like 'Line 14: Unexpected token'. Valid lines still convert. You see exactly which lines need fixing.

Blank lines and BOM characters

Log pipelines often produce trailing newlines or UTF-8 BOM characters at the file start. These are stripped silently before parsing.

Single object input (JSON → NDJSON)

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.

Nested objects preserved

Nested objects and arrays inside each record are kept intact — serialized as compact inline JSON on that line, not flattened.

Large log files

Each line is parsed independently, so files up to ~100 MB typically process in seconds in the browser without memory issues.

Frequently asked questions

What is NDJSON and why do log systems use it?

NDJSON (Newline Delimited JSON) stores one complete JSON object per line. Log systems use it because it's streamable — you can append a new log entry without rewriting the entire file, and you can read a partially-written file line by line. Standard JSON arrays can't be appended to without breaking the structure.

What's the difference between NDJSON, JSONL, and JSON Lines?

Nothing — they're the same format. NDJSON is the formal name from the ndjson.github.io spec. JSONL is used by BigQuery and some Python libraries. JSON Lines is the name used by the jsonlines.org spec. All three: one JSON object per line, newline as separator.

How do I use this for Elasticsearch bulk imports?

Elasticsearch's bulk API expects alternating action/document lines in NDJSON format. Build your JSON array with the action objects and document objects interleaved, then convert to NDJSON. Each pair of lines becomes one bulk operation.

My log file has some non-JSON lines mixed in. What happens?

Non-JSON lines produce a warning with the exact line number (e.g. 'Line 14: Unexpected token'). Valid lines still convert. You'll see both the converted output and a list of which lines failed, so you can fix or filter them.

Can I convert NDJSON to CSV or Excel?

Yes. Convert to JSON array first using the NDJSON → JSON direction, then use the JSON to CSV or JSON to Excel converters. The two-step pipeline works well for log analysis.

Does BigQuery support NDJSON exports?

Yes. BigQuery's JSON export format is NDJSON (one object per line). Paste the export directly into NDJSON → JSON mode and the converter produces a standard JSON array.