Skip to main content

NDJSON Formatter & Validator

Validate newline-delimited JSON line-by-line (each bad line flagged, never crashing the rest), pretty-print or minify every record while keeping the NDJSON structure, and convert NDJSON to and from a JSON array. Optionally sort object keys.

Input

Drop a file or browse
One file · text
Or

Options

Output

Validation report

Report
LineStatusError
No data yet
Output
 
Was this helpful?

Guides

NDJSON — newline-delimited JSON, also written as JSONL or JSON Lines — is a plain-text format where every line holds one complete, self-contained JSON value. Because records are separated by line breaks rather than wrapped in a single top-level array, a program can read, write, and process one record at a time without ever holding the whole file in memory. That streaming-friendliness is why NDJSON has become the default for machine-to-machine data.

This tool validates NDJSON line by line, reformats it, and converts it to and from a regular JSON array — entirely in your browser. Paste your data, or upload a .ndjson / .jsonl file, and it processes as you type.

What it does

  • Validate only — checks every line and produces a report table with the line number, a Valid / Invalid / Blank status, and the exact parser error for any line that isn't valid JSON. A single broken line is flagged and skipped; the rest of the file is still validated, so you see all the problems at once.
  • Format (pretty-print) — expands each record onto multiple indented lines (2 spaces, 4 spaces, or a tab) for readability, while keeping the one-record-per -entry NDJSON structure.
  • Minify — collapses each record to the most compact single line, stripping insignificant whitespace — ideal before shipping logs or streaming payloads.
  • NDJSON → JSON array — wraps every valid record into one standard JSON array, ready for tools that expect a single JSON document.
  • JSON array → NDJSON — the reverse: turns a [ … ] array into one minified record per line.

You can also sort object keys alphabetically (applied recursively, arrays keep their order) for stable, diff-friendly output, and skip blank lines so empty rows don't clutter the result.

Common uses for NDJSON

  • Log files — application and access logs are frequently written one JSON event per line, so each entry can be appended and tailed independently.
  • Streaming APIs — many HTTP APIs stream results as NDJSON so a client can begin processing early records before the response finishes (Elasticsearch's bulk API, for instance, speaks NDJSON).
  • Machine-learning datasets — JSONL is the standard for training and fine-tuning corpora, where each line is one example or prompt/response pair.
  • Data pipelines & exports — database dumps and ETL jobs use NDJSON so huge datasets stream through row by row instead of loading a giant array.

Is NDJSON the same as a JSON array?

No. A JSON array is one document — [{...},{...}] — that must be parsed as a whole. NDJSON is many independent documents separated by newlines, which is what makes it appendable and streamable. Use the two conversion modes above to move between them.

Is my data uploaded anywhere?

No. All parsing and formatting runs locally in your browser; your NDJSON never leaves your device.

ndjsonjsonljsonvalidatorformatter

Part of a workflow

All collections

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.