Tutorial · 5 min read

How to Convert JSON Lines (NDJSON) to CSV Online

JSON Lines (NDJSON) is the go-to format for streaming data, log files, and big data pipelines. Each line is a complete JSON object — perfect for processing line by line. Use a NDJSON to CSV converter to transform these streams into tabular data for analysis.

1. What is NDJSON

NDJSON (Newline Delimited JSON) is a simple format where each line is a valid JSON object. Unlike a JSON array, the entire file is not a single JSON structure — which makes it streamable:

{"id":1,"name":"Alice","role":"admin"} {"id":2,"name":"Bob","role":"user"} {"id":3,"name":"Charlie","role":"editor"}

This format is widely used in:

CSV is the natural target format because each JSON object becomes one CSV row.

2. Auto-Detection of NDJSON Format

A good converter automatically detects whether your input is NDJSON or regular JSON:

JSONXX's NDJSON converter detects the format automatically, so you don't need to think about it.

3. Handling Inconsistent Fields Across Lines

Real-world NDJSON often has inconsistent field names. Log files, for example, may have optional fields that only appear in some entries:

{"event":"login","user":"alice","ip":"10.0.0.1"} {"event":"purchase","user":"bob","amount":29.99,"currency":"USD"} {"event":"login","user":"charlie","ip":"10.0.0.2"}

The converter handles this by:

This is especially important when dealing with nested NDJSON — see the nested NDJSON handling guide for advanced cases.

4. Encoding for Excel Compatibility

When converting NDJSON to CSV for Excel, encoding matters:

JSONXX's converter adds the BOM and handles quoting automatically, producing Excel-ready CSVs.

5. Large File Processing Tips

Processing large NDJSON files requires some strategy:

For post-conversion analysis, use the JSON to Excel or JSON Editor tools for additional transformations.

Convert NDJSON to CSV Now

Auto-detects NDJSON, handles inconsistent fields, produces Excel-ready CSV output.

Convert NDJSON Now →

Frequently Asked Questions

What's the difference between NDJSON and JSONL?

NDJSON and JSONL are the same format — one JSON object per line separated by newlines. NDJSON is the formal spec name; JSONL is the common file extension.

How does the converter handle inconsistent fields across lines?

It scans all lines to collect every unique field name. Lines with missing fields get empty values in the CSV. Lines with extra fields get additional columns.

Is there an upload size limit?

The converter handles files up to 50MB in the browser. For larger files, split into chunks or use a command-line tool like jq.

Can I convert compressed NDJSON files?

Not directly in browser-based tools. Decompress .gz or .zip files first using a standard decompression tool, then upload the plain NDJSON.

Are there CSV row limits I should worry about?

Excel supports up to 1,048,576 rows per sheet. If your NDJSON exceeds this, split the CSV into multiple files before opening in Excel.

Looking for more guides? See the full JSONXX How To index.