JsonSnacksRuns in your browser

JSON vs JSONL (NDJSON)

JSON stores a single value, usually one big object or array. JSONL (also called NDJSON) stores one complete JSON value on each line, so files can be streamed, appended to and processed line by line. Use JSON for documents and API responses, and JSONL for logs and large record sets.

Try it: JSONL / NDJSON ViewerBrowse line-delimited JSON logs as a table. Filter by level and spot broken lines.

Side by side

// JSON
[
  {"id": 1, "msg": "start"},
  {"id": 2, "msg": "stop"}
]

// JSONL
{"id": 1, "msg": "start"}
{"id": 2, "msg": "stop"}

Why JSONL exists

  • You can append a record by adding a line, without rewriting the file.
  • A reader can process one line at a time, so memory use stays small for huge files.
  • One broken line does not make the rest of the file unreadable.
  • Tools like grep, head and tail work on it directly.

Rules

  • Each line must be a valid JSON value, usually an object.
  • Lines are separated by a newline character.
  • Values must not contain raw line breaks. Pretty-printed JSON is not JSONL.
  • UTF-8 is the usual encoding.

Converting

To go from a JSON array to JSONL, write each element on its own line in compact form. To go back, wrap the lines in [ ] with commas. The JSONL Viewer opens a JSONL file as a table, and the JSON to CSV tool turns records into rows.

Which should you use?

Choose JSON for configuration, API responses and anything a person edits. Choose JSONL for logs, event streams, machine-learning datasets and bulk exports.

Frequently asked questions

Is JSONL valid JSON?

The whole file is not, because it holds several top-level values. Each line on its own is valid JSON.

What file extension does JSONL use?

.jsonl is common, and .ndjson is used for the same format. Logs sometimes use .log.

Published 2026-10-23. Last updated 23 October 2026.