NDJSON / JSONL (JSON Lines) explained
If you have a .ndjson or .jsonl file and a tool expects a normal JSON array
([...]), you need a simple conversion. This guide explains the format, the common parsing
errors, and the safest workflow.
What is NDJSON / JSONL?
NDJSON (Newline Delimited JSON) and JSONL (JSON Lines) are the same idea: each line is a complete, standalone JSON value. Most often, each line is a JSON object:
{"id":1,"event":"signup"}
{"id":2,"event":"purchase"}
{"id":3,"event":"logout"}
Because lines are independent, systems can append new events without rewriting a giant file. That’s why NDJSON is common for logs, analytics exports, and data pipelines.
NDJSON vs a JSON array
A regular JSON array wraps everything in [ and ] and separates items with
commas:
[
{"id":1,"event":"signup"},
{"id":2,"event":"purchase"},
{"id":3,"event":"logout"}
]
NDJSON is usually easier to stream and process line-by-line. A JSON array is usually easier to load in typical “parse everything” APIs.
Common NDJSON/JSONL pitfalls
- Each non-empty line must be valid JSON. Trailing commas and comments are not allowed.
- Empty lines exist in real files. Most readers ignore them; some strict parsers don’t.
- Log prefixes break parsing. Example: timestamps before
{...}. - Newlines inside strings must be escaped. A literal line break inside a string makes the line invalid.
How to convert NDJSON to JSON (array)
- Open the no-upload converter.
- Paste NDJSON/JSONL (or a JSON array).
- Click NDJSON → JSON to produce a JSON array.
- If you see a “Line N is not valid JSON” error, inspect that line for stray characters.
How to convert JSON (array) to NDJSON
If you have a JSON array of objects and you need one item per line (for ingestion tools or streaming), click JSON → NDJSON. Each array element becomes its own line.
FAQ
Are NDJSON and JSONL different? In practice, they’re interchangeable names for the
same “JSON per line” format. You’ll see both .ndjson and .jsonl extensions.
Can each line be an array or a string? Yes. Each line can be any valid JSON value, but objects are the most common.
Related by intent
Useful follow-up pages selected from real search impressions and no-click opportunities.
Related by winning cluster
Linked from a winner family to push crawl and first-impression conversion.
Next pages to check
Closest crawled pages without impressions yet. Added to speed first-impression conversion.
Quick fix checklist
- Reproduce the error on a minimal input.
- Check type/format and field mapping.
- Apply the smallest safe fix.
- Validate on production-like payload.