JSON Lines / NDJSON Formatter
Paste a JSON Lines (NDJSON) document — one JSON object per line — and this tool validates every entry and pretty-prints it. Errors are reported per line, so you instantly find the broken record in large files. Great for logs, event streams, and ndjson exports.
What is JSON Lines / NDJSON Formatter?
Pretty-print and validate NDJSON/JSON Lines data line by line. Paste a JSON Lines (NDJSON) document — one JSON object per line — and this tool validates every entry and pretty-prints it. Errors are reported per line, so you instantly find the broken record in large files. Great for logs, event streams, and ndjson exports. The tool runs 100% in your browser — nothing is uploaded to a server, so your data stays private, and it is free to use with no signup required.
Quick Answers
- What is JSON Lines (NDJSON)?
- JSON Lines is a format where each line is a self-contained, valid JSON value, separated by a newline. It is ideal for streaming and large logs because records can be processed one at a time.
- What happens when one line is invalid?
- The tool reports the exact line number and character position of the first invalid record, along with the failing line, so you can fix the export quickly.
- Can I turn a pretty JSON file into JSON Lines?
- Use the related formatter tools here to compact the data first, then split so each object sits on its own line.
How to use JSON Lines / NDJSON Formatter
- Paste your JSON Lines / NDJSON data, one object per line.
- Each valid line is validated and pretty-printed; the first invalid line is flagged by number.
- Copy the formatted output or download it as a file.
Why use our json lines / ndjson formatter?
JSON Lines (also called NDJSON or newline-delimited JSON) is the format used by log exporters, event pipelines, Elasticsearch bulk APIs and BigQuery export files. Working with it is harder than single-document JSON because one bad record can stop an entire import. This formatter splits your document into individual lines, parses each one, reports the exact line number of the first invalid entry, and pretty-prints every valid record with two-space indentation. The summary header shows how many lines were valid. All processing stays in your browser.
Single-document JSON vs JSON Lines (NDJSON)
JSON Lines stores one JSON value per line instead of one big tree. Understanding the difference explains why NDJSON 'fails line by line' and why the formatter reports by line number.
| Aspect | Single JSON document | JSON Lines (NDJSON) |
|---|---|---|
| Structure | One hierarchical tree in one block | Many independent values, one per line |
| Streaming | Whole document must be parsed | Records can be processed one by one |
| Failure mode | One error invalidates the whole file | Bad records isolated to their own line |
| Typical use | API payloads, config files | Logs, event streams, BigQuery/Elasticsearch |
| Human diffing | Whole-tree diff | Line-based diffs work naturally |
Repairing a BigQuery or log export with one bad record
JSON Lines files from logs, BigQuery exports and event pipelines fail completely when a single line is malformed. This formatter flags the offending line number so you can repair that one record.
JSON Lines input
{"event":"click","user":"alice","ts":1770000000000}
{"event":"view","user":"bob","ts":1770000000001}
{"event":"purchase","user":"alice","ts":1770000000002,}
{"event":"signup","user":"carol","ts":1770000000003}Validator report
2 of 4 lines are valid JSON before the error on line 3.
Invalid JSON on line 3: Unexpected token }, ... (at character 58)
Line content:
{"event":"purchase","user":"alice","ts":1770000000002,}
Remove the trailing comma on line 3 and re-run to see all four records pretty-printed.Paste a JSONL/NDJSON export from a log pipeline, BigQuery, or Elasticsearch bulk file — find and fix the single broken record instead of hunting through thousands of lines.
Frequently Asked Questions
Related Tools
JSON to YAML Converter
Turn JSON objects and arrays into clean, indented YAML in one click.
YAML to JSON Converter
Turn YAML configs into formatted JSON in one click.
JSON to CSV Converter
Convert JSON arrays and objects to clean CSV in one click.
CSV to JSON Converter
Turn CSV tables into formatted JSON in one click.
JSON Formatter & Beautifier
Pretty-print and validate JSON in one click.
JSON Minifier – Remove Whitespace Online
Compress JSON by stripping all unnecessary whitespace.