JSONL vs NDJSON

Updated November 4, 2026

JSONL and NDJSON are the same format for almost every practical purpose: one JSON value per line, in UTF-8. They come from two separate specifications that differ in small ways, mainly on blank lines, final newlines and naming. A file that follows the stricter reading of both rules works everywhere.

Differences between the specifications

JSON Lines NDJSON
File extension .jsonl .ndjson
Media type application/jsonl (not yet standardized) application/x-ndjson
Final newline Strongly recommended Required: each text must be followed by a newline
Blank lines Not valid Parsers may ignore them, if documented
Line endings \n; \r\n works because whitespace is ignored Parsers must accept \n and \r\n
Byte order mark Must not be included Not addressed; UTF-8 is required

How to write a file that works with both

  • Use UTF-8 without a byte order mark.
  • Put one JSON value on each line.
  • End every line with \n, including the last one.
  • Leave out blank lines.

Which name should you use?

Follow whatever your tools expect. Many LLM providers, including OpenAI, ask for .jsonl files. The file extension rarely changes how the content is parsed, but an upload form may reject an extension it does not recognize.

To check a file against these rules, use the JSONL validator, which flags blank lines and byte order marks.